Skip to content

ci: fail fast when the Windows pipeline would publish a non-release tag - #215

Merged
Shengyu Fu (shengyfu) merged 1 commit into
mainfrom
shengyfu-fix-stray-main-tag
Oct 22, 2026
Merged

Shengyu Fu (shengyfu) merged 1 commit into
mainfrom
shengyfu-fix-stray-main-tag

Conversation

@shengyfu

Copy link
Copy Markdown
Member

Fixes #213

What happened

refs/tags/main (lightweight, on 0b3b528, the same commit as v0.1.11) shadowed refs/heads/main, so git pull origin main fetched the stale tag and did nothing.

Already done (outside this PR)

  • Deleted the remote tag with git push --force-with-lease=refs/tags/main:0b3b528f5a1961a4beaeff106cd9217199788375 origin :refs/tags/main. git fetch origin main now resolves to the branch. No release, workflow or script used that tag, and v0.1.11 is untouched.
  • To undo: git push origin 0b3b528f5a1961a4beaeff106cd9217199788375:refs/tags/main.

Likely cause and prevention (this PR)

sign-and-release.yml (the Azure DevOps OneBranch signing pipeline) defaulted ReleaseTag to main, and its GitHubRelease@1 steps use action: edit, which creates the tag when no release exists for it. A publishing run that kept the default would create exactly this tag. That fits the evidence, but I can't confirm it from here, since the pipeline runs in ADO.

  • ReleaseTag now defaults to unreleased. Outside publishing it only names the artifacts.
  • With PublishToGitHub enabled, the first step of both jobs rejects anything other than v<major>.<minor>.<patch>[-pre], before any build or signing work.
  • CONTRIBUTING.md notes the requirement next to the Windows signing paragraph.

Verification

  • Reproduced the bug against the real remote, then confirmed the fix with git ls-remote origin main and git fetch --dry-run origin main.
  • Parsed the pipeline YAML and simulated the PublishToGitHub expansion: the guard is the first step of both jobs only when publishing, and the publish steps are unchanged.
  • Ran the guard script, extracted verbatim from the YAML, against 16 tags. It accepts v1.2.4 and v1.3.0-rc.1, and rejects main, v2-dev, 1.2.4, V1.2.4, refs/tags/v1.2.4 and the empty string.
  • Not run in ADO/OneBranch (no access from here). A dry run with PublishToGitHub on and a bad tag would confirm the failure message.

Follow-ups (not in this PR)

  • A tag ruleset limiting tag creation to v* would block this class of mistake at the source. It needs repo admin; all current rulesets target branches only.
  • Anyone who already has the stale tag locally: git tag -d main, then git pull origin main.

GitHubRelease@1 (action: edit) creates the tag when no release exists for it. ReleaseTag defaulted to `main`, so publishing without overriding it created a lightweight `main` tag that shadows the `main` branch: `git pull origin main` fetched the stale tag and silently did nothing.

- Default ReleaseTag to `unreleased`; outside publishing it only names the artifacts.
- When PublishToGitHub is enabled, validate ReleaseTag as v<major>.<minor>.<patch>[-pre] in the first step of both jobs, before any build or signing work.
- Document the requirement in CONTRIBUTING.md.

The stray remote tag itself (0b3b528, the same commit as v0.1.11) was deleted separately.

Fixes #213

Co-authored-by: Copilot App <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 22, 2026 02:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Both publishing paths have consistent early validation and no blocking issues were identified, though execution in Azure DevOps remains unverified.

No open issues 🎉

What changed in this PR

Prevents the Windows signing pipeline from accidentally publishing a branch-named tag, addressing the cause suspected in #213.

Changes:

  • Changes the default ReleaseTag from main to unreleased.
  • Adds publishing-only release-tag validation before build and signing work in both architecture jobs.
  • Documents the publishing requirement and branch-shadowing risk.
File Description
CONTRIBUTING.md Documents the required release-tag format when publishing Windows artifacts.
.github/​workflows/​sign-and-release.yml Sets a non-branch default and adds early validation to both publishing jobs.

Review effort: Balanced

@shengyfu
Shengyu Fu (shengyfu) merged commit d25ade6 into main Oct 22, 2026
16 checks passed
@shengyfu
Shengyu Fu (shengyfu) deleted the shengyfu-fix-stray-main-tag branch October 22, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stray main tag makes git pull origin main a silent no-op (tag shadows branch)

2 participants