Skip to content

Commit

Permalink
Update release notes action for new release model (#3748)
Browse files Browse the repository at this point in the history
* Update release notes action for new release model

* Include newlines

* Switch to actions/github-script

* Fix token input

* Named arguments, get owner/repo from context

* Return specific data and update vars

* Last fixes, hopefully

* Set result encoding to string

* Prevent echo from printing directory contents
  • Loading branch information
jpelgrom committed Aug 1, 2023
1 parent 91fdba5 commit bf0479a
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 8 deletions.
49 changes: 41 additions & 8 deletions .github/actions/create-release-notes/action.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,56 @@
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
gh-token:
description: 'The GitHub token used to get details from the API'
required: true
runs:
using: 'composite'
steps:
- name: Get Previous Release Tag
uses: actions/github-script@v6
id: latest-release-tag
with:
github-token: ${{ inputs.gh-token }}
result-encoding: string
script: |
const { data } = await github.rest.repos.getLatestRelease({
owner: context.repo.owner,
repo: context.repo.repo,
})
return data.tag_name
- name: Get Generated Release Notes
uses: actions/github-script@v6
id: generate-notes
with:
github-token: ${{ inputs.gh-token }}
result-encoding: string
script: |
const { data } = await github.rest.repos.generateReleaseNotes({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: '${{ inputs.tag-name }}',
target_commitish: 'master',
previous_tag_name: '${{ steps.latest-release-tag.outputs.result }}',
})
return data.body
- name: Generate Release Notes
id: version-generator
shell: bash
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:"
echo "${{ steps.latest-release-tag.outputs.result }}"
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="${{ steps.generate-notes.outputs.result }}"
echo -e "$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
10 changes: 10 additions & 0 deletions .github/workflows/onPush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
app_build:
name: Github, Firebase, and Sentry Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -54,6 +56,9 @@ jobs:

- uses: ./.github/actions/create-release-notes
name: Create Release Notes
with:
tag-name: ${{ steps.rel_number.outputs.version }}
gh-token: ${{ secrets.GITHUB_TOKEN }}

- uses: ./.github/actions/download-translations
name: Download Translations
Expand Down Expand Up @@ -118,6 +123,8 @@ jobs:
runs-on: ubuntu-latest
concurrency:
group: playstore_deploy
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -157,6 +164,9 @@ jobs:

- uses: ./.github/actions/create-release-notes
name: Create Release Notes
with:
tag-name: ${{ steps.rel_number.outputs.version }}
gh-token: ${{ secrets.GITHUB_TOKEN }}

- uses: ./.github/actions/download-translations
name: Download Translations
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ jobs:

pr_build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -104,6 +106,9 @@ jobs:
- uses: ./.github/actions/create-release-notes
name: Create Release Notes
with:
tag-name: ${{ steps.rel_number.outputs.version }}
gh-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build Debug APK
run: ./gradlew assembleDebug
Expand Down

0 comments on commit bf0479a

Please sign in to comment.