Skip to content

Commit

Permalink
Merge pull request #643 from ergebnis/feature/release
Browse files Browse the repository at this point in the history
Enhancement: Automatically generate release body
  • Loading branch information
localheinz authored Jan 21, 2022
2 parents 4b9c15b + ae6a750 commit efd19cd
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,37 @@ jobs:
runs-on: "ubuntu-latest"

steps:
- name: "Determine tag"
id: "determine-tag"
run: "echo \"::set-output name=tag::${GITHUB_REF#refs/tags/}\""
- name: "Determine release tag"
run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV"

- name: "Determine release body"
uses: "actions/github-script@v5"
with:
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
script: |
const repository = context.repo;
const response = await github.rest.repos.generateReleaseNotes({
owner: repository.owner,
repo: repository.repo,
tag_name: "${{ env.RELEASE_TAG }}",
})
core.exportVariable("RELEASE_BODY", response.data.body)
- name: "Create release"
uses: "actions/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
uses: "actions/github-script@v5"
with:
draft: false
prerelease: false
release_name: "${{ steps.determine-tag.outputs.tag }}"
tag_name: "${{ steps.determine-tag.outputs.tag }}"
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}"
script: |
const repository = context.repo
await github.rest.repos.createRelease({
body: "${{ env.RELEASE_BODY }}",
draft: false,
name: "${{ env.RELEASE_TAG }}",
owner: repository.owner,
prerelease: false,
repo: repository.repo,
tag_name: "${{ env.RELEASE_TAG }}",
})

0 comments on commit efd19cd

Please sign in to comment.