diff --git a/.generate-changelog-delta.sh b/.generate-changelog-delta.sh new file mode 100755 index 00000000..3d4c3856 --- /dev/null +++ b/.generate-changelog-delta.sh @@ -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 '```' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7014028b..bc825468 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -235,12 +235,15 @@ jobs: name: dist-windows path: dist-windows + - name: Generate CHANGELOG delta for Goreleaser to consume + run: ./.generate-changelog-delta.sh > ./.CHANGELOG.delta.md + - name: GoReleaser (publish) uses: goreleaser/goreleaser-action@v3 with: distribution: goreleaser-pro version: ${{ env.GORELEASER_VERSION }} - args: release -f .goreleaser.yml + args: release --release-notes=./.CHANGELOG.delta.md -f .goreleaser.yml env: GITHUB_TOKEN: ${{ secrets.GH_PAT }} GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} diff --git a/.gitignore b/.gitignore index 610290ac..06d0d522 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,4 @@ goreleaser-test.sh /manpages /cli/test.db /*.db +/.CHANGELOG.delta.md