diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 82542be..fca8353 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,7 +58,12 @@ jobs: run: ctest -C Release --output-on-failure # Package a single source archive and publish the release. + # + # Only runs for tag pushes. A release cannot be published from a branch, so on + # workflow_dispatch this job is skipped and the workflow acts as a dry run of + # the cross-platform build and test gate above. release: + if: startsWith(github.ref, 'refs/tags/') needs: build runs-on: ubuntu-latest permissions: @@ -71,10 +76,33 @@ jobs: - name: Package source archive run: zip -r anim-${{ github.ref_name }}-src.zip include src cmake CMakeLists.txt README.md LICENSE CONTRIBUTING.md CHANGELOG.md + # Use the CHANGELOG entry for this tag as the release body, so the notes are + # written once and reviewed in the pull request that introduced them. + - name: Extract release notes from CHANGELOG + run: | + version="${GITHUB_REF_NAME#v}" + awk -v v="$version" ' + $0 ~ "^## \\[" v "\\]" { found = 1; next } # heading for this version + found && /^## \[/ { exit } # next version heading + found && /^\[.*\]: / { exit } # link reference block + found && /^