workflow: should now publish custom release notes to GH releases

This commit is contained in:
neilotoole 2023-03-25 20:25:15 -06:00
parent d8993c9a30
commit e72c0978f4
3 changed files with 19 additions and 1 deletions

14
.generate-changelog-delta.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
# This script the per-release changelog file for goreleaser to use
# to publish to GitHub releases.
curTag=$(git tag --sort=-creatordate | head -n 1)
prevTag=$(git tag --sort=-creatordate | head -n 2 | tail -n 1)
git diff "$prevTag" "$curTag" --no-ext-diff --unified=0 --exit-code -a --no-prefix -- ./CHANGELOG.md \
| grep -E "^\+" | grep -v '+++ CHANGELOG.md' | cut -c 2-
echo '### Commits'
echo '```text'
git log --pretty=format:'%h %s%n' "$prevTag".."$curTag"
echo '```'

View File

@ -235,12 +235,15 @@ jobs:
name: dist-windows name: dist-windows
path: dist-windows path: dist-windows
- name: Generate CHANGELOG delta for Goreleaser to consume
run: ./.generate-changelog-delta.sh > ./.CHANGELOG.delta.md
- name: GoReleaser (publish) - name: GoReleaser (publish)
uses: goreleaser/goreleaser-action@v3 uses: goreleaser/goreleaser-action@v3
with: with:
distribution: goreleaser-pro distribution: goreleaser-pro
version: ${{ env.GORELEASER_VERSION }} version: ${{ env.GORELEASER_VERSION }}
args: release -f .goreleaser.yml args: release --release-notes=./.CHANGELOG.delta.md -f .goreleaser.yml
env: env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }} GITHUB_TOKEN: ${{ secrets.GH_PAT }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

1
.gitignore vendored
View File

@ -52,3 +52,4 @@ goreleaser-test.sh
/manpages /manpages
/cli/test.db /cli/test.db
/*.db /*.db
/.CHANGELOG.delta.md