diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 11ff85ac..d911ac32 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -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/create-release@v1.1.4" - 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 }}", + })