diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fca8353..956cfc4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -70,6 +70,22 @@ jobs: contents: write steps: - uses: actions/checkout@v7 + with: + fetch-depth: 0 + + # Squash-merging a pull request rewrites the commit, so a tag pushed to the + # pre-merge branch tip builds and tests green while pointing at a commit + # reachable only from the tag. Publishing that produces a release whose + # history is not on main, which is only noticed much later by whoever pins + # it. Refuse the tag instead. + - name: Verify the tag is on main + run: | + git fetch --no-tags origin +refs/heads/main:refs/remotes/origin/main + if ! git merge-base --is-ancestor "$GITHUB_SHA" refs/remotes/origin/main; then + echo "::error::$GITHUB_REF_NAME ($GITHUB_SHA) is not an ancestor of main. Delete the tag, then re-tag the merged commit on main." >&2 + exit 1 + fi + echo "$GITHUB_REF_NAME is on main." # One platform-independent, buildable source archive (headers + sources + # CMake config). GitHub also attaches auto-generated "Source code" archives. @@ -81,12 +97,16 @@ jobs: - 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 && /^ -[Unreleased]: https://github.com/Actualize-Interactive/anim/compare/v0.2.0...HEAD +[Unreleased]: https://github.com/Actualize-Interactive/anim/compare/v0.3.0...HEAD +[0.3.0]: https://github.com/Actualize-Interactive/anim/compare/v0.2.0...v0.3.0 [0.2.0]: https://github.com/Actualize-Interactive/anim/compare/v0.1.2...v0.2.0 [0.1.2]: https://github.com/Actualize-Interactive/anim/releases/tag/v0.1.2 [0.1.1]: https://github.com/Actualize-Interactive/anim/releases/tag/v0.1.1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 28059a4..4d7640e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.25) -project(anim VERSION 0.2.0 LANGUAGES CXX) +project(anim VERSION 0.3.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON)