action-gh-release icon indicating copy to clipboard operation
action-gh-release copied to clipboard

Add option to use annotated tag message as release notes

Open spenserblack opened this issue 2 years ago • 9 comments

Annotated tags can contain release notes, and it would be nice if this action provided an option to use the tag's message as the GitHub Release notes.

spenserblack avatar Sep 22 '21 13:09 spenserblack

Note: Looks like git tag -l --format="%(contents:body)" <tag name> gets the tag message. Until this is implemented a workaround could be to write the contents to a file and use body_path, or set the result as an output in a previous step.

spenserblack avatar Nov 10 '21 15:11 spenserblack

I think I finally got the workaround working :weary: This is an example of what I did

name: Release
on:
  push:
    tags: ['v*.*.*']

jobs:
  release-notes:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
        with:
          ref: ${{ github.ref }}
      - name: Get Release Notes
        run: 'echo "$(git tag -l --format="%(contents:body)" $GITHUB_REF_NAME)" > RELEASE_NOTES'
      - name: Set Release Notes
        uses: softprops/action-gh-release@v1
        with:
          body_path: RELEASE_NOTES

spenserblack avatar Nov 10 '21 17:11 spenserblack

Neat trick. Quick heads up this action now supports GitHubs automatically generated release notes

https://github.com/softprops/action-gh-release/blob/58fa4b7a8863f6beaf115a49196308842b8b0f06/action.yml#L43

softprops avatar Dec 05 '21 03:12 softprops

I would still like to use the tag annotation as release notes xd

Fuseteam avatar Mar 22 '22 22:03 Fuseteam

@Fuseteam I ended up writing a simple action that uses gh since I was repeating the same workflow a lot. It doesn't do much except take the subject (first line) of a tag message and make it the release title, and take the body (lines 3 and over) and make it the release body. Feel free to check it out :smiley: If you need more complicated usage, you can use tag-to-release to create a release and this action to do other stuff like upload assets.

spenserblack avatar Mar 22 '22 22:03 spenserblack

@spenserblack awesome i'll take a look xD

Fuseteam avatar Mar 22 '22 22:03 Fuseteam

@spenserblack i tried to combine it but it used my commit message as the title and left the body empty xd i think this overwrote it :p

Fuseteam avatar Mar 22 '22 22:03 Fuseteam

Oh yeah it pretty naively tries to get the latest tag message. It also needs to be checked out at the ref (see the actions/checkout part of the example). The action actually uses itself, so you can see that as an example. https://github.com/spenserblack/actions-tag-to-release/blob/d5607a72fb47a8614e1154ca456d5b7eaf0c10ab/.github/workflows/release.yml#L1-L16

If you have any more trouble with it please open an issue on that repo 🙂

spenserblack avatar Mar 22 '22 22:03 spenserblack

Cool thanks~

Fuseteam avatar Mar 22 '22 22:03 Fuseteam