Skip to content

Commit 97a063f

Browse files
committed
another attempt
1 parent 1e3e8ce commit 97a063f

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

.github/workflows/release.yml

+17-1
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,27 @@ jobs:
3838
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
3939
PASSPHRASE: ${{ secrets.PASSPHRASE }}
4040

41+
- name: Set GoReleaser args
42+
run: |
43+
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
44+
RELEASE_NOTES_DIR=$(mktemp -d)
45+
RELEASE_NOTES_FILE="$RELEASE_NOTES_DIR/release-notes.md"
46+
git for-each-ref --format='%(body)' ${{ github.ref }} > "$RELEASE_NOTES_FILE"
47+
echo "Release notes contents:"
48+
cat "$RELEASE_NOTES_FILE"
49+
GORELEASER_ARGS="--release-notes $RELEASE_NOTES_FILE"
50+
echo "GORELEASER_ARGS=$GORELEASER_ARGS" >> $GITHUB_ENV
51+
else
52+
echo "Not a release tag, skipping release notes"
53+
GORELEASER_ARGS="--snapshot"
54+
echo "GORELEASER_ARGS=$GORELEASER_ARGS" >> $GITHUB_ENV
55+
fi
56+
4157
- name: Run GoReleaser
4258
uses: goreleaser/goreleaser-action@v6
4359
with:
4460
version: ~> v2
45-
args: release --clean ${{ !startsWith(github.ref, 'refs/tags/v') && '--snapshot' || '' }} --release-notes <(git for-each-ref --format='%(body)' ${{ github.ref }})
61+
args: release --clean $GORELEASER_ARGS
4662
env:
4763
# use GITHUB_TOKEN that is already available in secrets.GITHUB_TOKEN
4864
# https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token

0 commit comments

Comments
 (0)