@@ -86,43 +86,35 @@ jobs:
8686 git config user.name "github-actions[bot]"
8787 git config user.email "github-actions[bot]@users.noreply.github.com"
8888
89- - name : Ensure v1.0.0-beta.1 points to a commit in main history
89+ - name : Prepare v1.0.0-beta.1 for semantic-release (real run only)
90+ if : github.event.inputs.dry_run != 'true'
9091 run : |
9192 set -e
92- # semantic-release uses "git tag --merged main"; the tag must point to a commit in main's history.
93- # Always move the tag to the 1.0.0-beta.1 release commit so it is visible to semantic-release.
93+ # semantic-release uses "git tag --merged main" and git notes; tag must be in main history and have note.
9494 if ! git rev-parse --verify v1.0.0-beta.1 >/dev/null 2>&1; then exit 0; fi
9595 RELEASE_COMMIT=$(git log main -1 --format=%H --grep="chore(release): 1.0.0-beta.1" 2>/dev/null || true)
9696 if [ -z "$RELEASE_COMMIT" ]; then
9797 RELEASE_COMMIT=$(git merge-base main origin/master 2>/dev/null || git rev-parse HEAD~1)
9898 fi
9999 CURRENT=$(git rev-parse v1.0.0-beta.1)
100- if [ "$CURRENT" = "$RELEASE_COMMIT" ]; then
101- echo "v1.0.0-beta.1 already points to $RELEASE_COMMIT."
102- exit 0
103- fi
104- git tag -d v1.0.0-beta.1 2>/dev/null || true
105- git tag -a v1.0.0-beta.1 "$RELEASE_COMMIT" -m "chore: 1.0.0-beta.1"
106- if [ "${{ github.event.inputs.dry_run }}" != "true" ]; then
100+ if [ "$CURRENT" != "$RELEASE_COMMIT" ]; then
101+ git tag -d v1.0.0-beta.1 2>/dev/null || true
102+ git tag -a v1.0.0-beta.1 "$RELEASE_COMMIT" -m "chore: 1.0.0-beta.1"
107103 git push origin v1.0.0-beta.1 --force
104+ echo "Moved v1.0.0-beta.1 from $CURRENT to $RELEASE_COMMIT."
108105 fi
109- echo "Moved v1.0.0-beta.1 from $CURRENT to $RELEASE_COMMIT."
106+ git notes --ref semantic-release-v1.0.0-beta.1 add -f -m '{"channels":["beta"]}' v1.0.0-beta.1
107+ git push origin refs/notes/semantic-release-v1.0.0-beta.1
108+ echo "Tag and note pushed; re-fetching so semantic-release sees them."
109+ git fetch origin '+refs/tags/*:refs/tags/*' '+refs/notes/*:refs/notes/*'
110110
111- - name : Add semantic-release note to v1.0.0-beta.1 if missing
111+ - name : Add semantic-release note (dry run only)
112+ if : github.event.inputs.dry_run == 'true'
112113 run : |
113114 set -e
114- # Existing v1.0.0-beta.1 tag has no git note, so semantic-release ignores it and tries to re-release it.
115- # Add the note so it is treated as last release and the next version is 1.0.0-beta.2.
116- if ! git rev-parse --verify v1.0.0-beta.1 >/dev/null 2>&1; then
117- echo "Tag v1.0.0-beta.1 not found, skipping note step."
118- exit 0
119- fi
120- # Always ensure the note exists (-f overwrites); required for get-last-release to see this tag on main.
115+ if ! git rev-parse --verify v1.0.0-beta.1 >/dev/null 2>&1; then exit 0; fi
121116 git notes --ref semantic-release-v1.0.0-beta.1 add -f -m '{"channels":["beta"]}' v1.0.0-beta.1
122- if [ "${{ github.event.inputs.dry_run }}" != "true" ]; then
123- git push origin refs/notes/semantic-release-v1.0.0-beta.1
124- fi
125- echo "Added semantic-release note to v1.0.0-beta.1"
117+ echo "Added semantic-release note to v1.0.0-beta.1 (local only for dry run)."
126118
127119 - name : Create initial tag if needed
128120 if : github.event.inputs.dry_run != 'true'
0 commit comments