Skip to content

Commit d15a64b

Browse files
committed
fix(release): restore semantic-release tag ancestry
1 parent 790c643 commit d15a64b

File tree

3 files changed

+24
-5485
lines changed

3 files changed

+24
-5485
lines changed

.github/workflows/release.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,42 @@ on:
44
push:
55
branches: [main]
66

7+
concurrency:
8+
group: release-${{ github.ref }}
9+
cancel-in-progress: false
10+
711
permissions:
812
contents: write
913
issues: write
1014
pull-requests: write
1115

1216
jobs:
1317
release:
18+
if: ${{ !startsWith(github.event.head_commit.message || '', 'chore(release):') }}
1419
runs-on: ubuntu-latest
1520
steps:
1621
- name: Checkout
1722
uses: actions/[email protected]
1823
with:
1924
fetch-depth: 0
2025

26+
- name: Validate release tag ancestry
27+
shell: bash
28+
run: |
29+
set -euo pipefail
30+
latest_tag="$(git tag -l 'v*' --sort=-version:refname | head -n 1 || true)"
31+
if [[ -z "${latest_tag}" ]]; then
32+
echo "No existing v* tags found; continuing."
33+
exit 0
34+
fi
35+
if git merge-base --is-ancestor "${latest_tag}" HEAD; then
36+
echo "Latest tag ${latest_tag} is reachable from HEAD."
37+
exit 0
38+
fi
39+
echo "::error::Latest tag ${latest_tag} is not reachable from HEAD. Release tags are out of sync with branch history."
40+
echo "::error::Fix by re-aligning tags to this branch history before running semantic-release."
41+
exit 1
42+
2143
- name: Set up Node
2244
uses: actions/setup-node@v6
2345
with:
@@ -31,6 +53,6 @@ jobs:
3153

3254
- name: Run semantic-release
3355
env:
34-
GITHUB_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN }}
56+
GITHUB_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN || github.token }}
3557
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
3658
run: npx semantic-release --extends ./release.config.mjs

0 commit comments

Comments
 (0)