From 622130bd20a34aafe8269892e9d81f0af5d50fac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joris=20Pelgr=C3=B6m?= Date: Wed, 12 Jul 2023 18:57:48 +0200 Subject: [PATCH] Update release notes action for new release model --- .../actions/create-release-notes/action.yml | 35 ++++++++++++++----- .github/workflows/onPush.yml | 4 +++ .github/workflows/pr.yml | 2 ++ 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/.github/actions/create-release-notes/action.yml b/.github/actions/create-release-notes/action.yml index 4c44cdf12a0..26e5409ca93 100644 --- a/.github/actions/create-release-notes/action.yml +++ b/.github/actions/create-release-notes/action.yml @@ -1,5 +1,9 @@ name: 'Create Release Notes' description: 'Creates the current releases release notes' +inputs: + tag-name: + description: 'Name of the tag that will be used for this release' + required: true runs: using: 'composite' steps: @@ -9,15 +13,30 @@ runs: run: | mkdir -p ./app/build/outputs/ - echo "Previous Release Commit:" - git tag -l --sort=-creatordate | grep -v beta- | head -n 1 - previous=`git tag -l --sort=-creatordate | grep -v beta- | head -n 1` + echo "Previous Release Tag:" + TAG=`\ + curl --no-progress-meter --request GET \ + --url "https://api.github.com/repos/home-assistant/android/releases/latest" \ + --header "Accept: application/vnd.github+json" \ + --header "Authorization: Bearer $GH_TOKEN" \ + --header "X-GitHub-Api-Version: 2022-11-28" \ + | jq -r .tag_name + ` + echo $TAG - echo "# Changes:" > ./app/build/outputs/changelogGithub - echo "Changlog:" - git log --format="* %s" ${previous}..HEAD - git log --format="* %s" ${previous}..HEAD >> ./app/build/outputs/changelogGithub + echo "Full Changelog:" + CHANGELOG=`\ + curl --no-progress-meter --request POST \ + --url "https://api.github.com/repos/home-assistant/android/releases/generate-notes" \ + --header "Accept: application/vnd.github+json" \ + --header "Authorization: Bearer $GH_TOKEN" \ + --header "X-GitHub-Api-Version: 2022-11-28" \ + --data "{\"tag_name\":\"${{inputs.tag-name}}\",\"target_commitish\":\"master\",\"previous_tag_name\":\"$TAG\"}" \ + | jq -r .body + ` + echo $CHANGELOG + printf "$CHANGELOG" > ./app/build/outputs/changelogGithub - echo "Beta Changelog" + echo "Beta Changelog:" git log --format="* %s" HEAD^..HEAD git log --format="* %s" HEAD^..HEAD > ./app/build/outputs/changelogBeta diff --git a/.github/workflows/onPush.yml b/.github/workflows/onPush.yml index 5f1b6605507..74df059b33f 100644 --- a/.github/workflows/onPush.yml +++ b/.github/workflows/onPush.yml @@ -44,6 +44,8 @@ jobs: - uses: ./.github/actions/create-release-notes name: Create Release Notes + with: + tag-name: ${{ steps.rel_number.outputs.version }} - uses: ./.github/actions/download-translations name: Download Translations @@ -130,6 +132,8 @@ jobs: - uses: ./.github/actions/create-release-notes name: Create Release Notes + with: + tag-name: ${{ steps.rel_number.outputs.version }} - uses: ./.github/actions/download-translations name: Download Translations diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 977556bd81c..bc0502e7b00 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -104,6 +104,8 @@ jobs: - uses: ./.github/actions/create-release-notes name: Create Release Notes + with: + tag-name: ${{ steps.rel_number.outputs.version }} - name: Build Debug APK run: ./gradlew assembleDebug