11# This GitHub action can publish assets for release when a tag is created.
22# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
33#
4- # This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your
4+ # This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your
55# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
66# secret. If you would rather own your own GPG handling, please fork this action
77# or use an alternative one for key handling.
88#
9- # You will need to pass the `--batch` flag to `gpg` in your signing step
9+ # You will need to pass the `--batch` flag to `gpg` in your signing step
1010# in `goreleaser` to indicate this is being used in a non-interactive mode.
1111#
1212name : release
@@ -28,31 +28,32 @@ jobs:
2828 runs-on : ubuntu-latest
2929 needs : [go-version]
3030 steps :
31- -
32- name : Checkout
31+ - name : Checkout
3332 uses : actions/checkout@v3
34- -
35- name : Unshallow
33+ - name : Unshallow
3634 run : git fetch --prune --unshallow
37- -
38- name : Set up Go
35+ - name : Set up Go
3936 uses : actions/setup-go@v2
4037 with :
4138 go-version : ${{ needs.go-version.outputs.go-version }}
42- -
43- name : Import GPG key
39+ - name : Import GPG key
4440 id : import_gpg
45414642 env :
4743 # These secrets will need to be configured for the repository:
4844 GPG_PRIVATE_KEY : ${{ secrets.GPG_PRIVATE_KEY }}
4945 PASSPHRASE : ${{ secrets.PASSPHRASE }}
50- -
51- name : Run GoReleaser
46+ - name : Generate Release Notes from Changelog
47+ run : |
48+ LATEST_TAG=$(git describe --abbrev=0 --match='v*.*.*' --tags | tr -d v)
49+ PREVIOUS_TAG=$(git describe --abbrev=0 --exclude="$(git describe --abbrev=0 --match='v*.*.*' --tags)" --match='v*.*.*' --tags | tr -d v)
50+ sed -n "/## $LATEST_TAG/,/## $PREVIOUS_TAG"'/{//!p;}' CHANGELOG.md > /tmp/RELEASE-NOTES.md
51+ cat /tmp/RELEASE-NOTES.md
52+ - name : Run GoReleaser
5253 uses :
goreleaser/[email protected] 5354 with :
5455 version : latest
55- args : release --rm-dist
56+ args : release --release-notes /tmp/RELEASE-NOTES.md -- rm-dist
5657 env :
5758 GPG_FINGERPRINT : ${{ steps.import_gpg.outputs.fingerprint }}
5859 # GitHub sets this automatically
0 commit comments