Skip to content

Commit f2d2082

Browse files
authored
Set release notes in a separate step during the release workflow (#4642)
## Changes https://github.com/databricks/terraform-provider-databricks/actions/runs/14443278474 shows that the release workflow is currently failing after my changes to publish the correct release notes. This seems to be due to an issue with the process substitution recommended at https://goreleaser.com/customization/release/#gitea, maybe to do with github actions behavior. Here, I've modified the process to configure the goreleaser arguments in a separate step. ## Tests Ran the if/else parts on my own machine with the `github.ref` interpolated. NO_CHANGELOG=true
1 parent 2709ff1 commit f2d2082

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)