1
1
# This GitHub action can publish assets for release when a tag is created.
2
2
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
3
3
#
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
5
5
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
6
6
# secret. If you would rather own your own GPG handling, please fork this action
7
7
# or use an alternative one for key handling.
8
8
#
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
10
10
# in `goreleaser` to indicate this is being used in a non-interactive mode.
11
11
#
12
12
name : release
@@ -28,31 +28,32 @@ jobs:
28
28
runs-on : ubuntu-latest
29
29
needs : [go-version]
30
30
steps :
31
- -
32
- name : Checkout
31
+ - name : Checkout
33
32
uses : actions/checkout@v3
34
- -
35
- name : Unshallow
33
+ - name : Unshallow
36
34
run : git fetch --prune --unshallow
37
- -
38
- name : Set up Go
35
+ - name : Set up Go
39
36
uses : actions/setup-go@v2
40
37
with :
41
38
go-version : ${{ needs.go-version.outputs.go-version }}
42
- -
43
- name : Import GPG key
39
+ - name : Import GPG key
44
40
id : import_gpg
45
41
46
42
env :
47
43
# These secrets will need to be configured for the repository:
48
44
GPG_PRIVATE_KEY : ${{ secrets.GPG_PRIVATE_KEY }}
49
45
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
52
53
uses :
goreleaser/[email protected]
53
54
with :
54
55
version : latest
55
- args : release --rm-dist
56
+ args : release --release-notes /tmp/RELEASE-NOTES.md -- rm-dist
56
57
env :
57
58
GPG_FINGERPRINT : ${{ steps.import_gpg.outputs.fingerprint }}
58
59
# GitHub sets this automatically
0 commit comments