fix(ci): publish from release branch instead of base branch#1049
fix(ci): publish from release branch instead of base branch#1049aidandaly24 wants to merge 1 commit intomainfrom
Conversation
The publish jobs were checking out main/preview which could serve a stale ref without the version bump commit. Now they checkout the release branch directly (release/v<version>) which is guaranteed to have the correct version. Added version verification before publish as a safety check.
Coverage Report
|
Publish will fail if the release branch is deleted after mergeLooking at recent merged release PRs, the The new publish flow depends on the release branch still existing at publish time: - name: Checkout release branch
uses: actions/checkout@v6
with:
ref: release/v${{ needs.prepare-main.outputs.version }}But Since Option 1 — Pin to a SHA captured at prepare time. Have # in prepare-main, after git push origin $BRANCH_NAME
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT# in publish-main
with:
ref: ${{ needs.prepare-main.outputs.sha }}Option 2 — Go back to checking out Option 3 — Keep this PR's approach but prevent branch deletion. Disable auto-delete-on-merge for the repo, and/or add a note/comment on the release PR asking reviewers not to delete the branch. This is the most fragile option since it relies on human discipline. I'd recommend Option 1 — it's the smallest change and doesn't depend on branch retention or repo settings. A related but smaller concern: the tag creation step also runs against the release-branch checkout, so the tag ends up on the bump commit (e.g. |
Description
The publish jobs were checking out
main/previewwhich could serve a stale git ref that didn't include the version bump commit. This caused 0.12.1 to be published with the 0.12.0 package.json.Now the publish jobs checkout
release/v<version>directly, which is guaranteed to have the correct version. Added a version verification step beforenpm publishas a safety check.Prior art — how other OSS repos handle this
None of these projects publish from the base branch HEAD — they all publish from a release branch, staging branch, or tag ref.
Related Issue
Closes #
Documentation PR
N/A
Type of Change
Testing
How have you tested the change?
npm run test:unitandnpm run test:integnpm run typechecknpm run lintsrc/assets/, I rannpm run test:update-snapshotsand committed the updated snapshotsChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.