Skip to content

fix: clean up RC tags for custom tag prefixes on publish#190

Merged
joshua-temple merged 1 commit into
mainfrom
fix/rc-tag-prefix-cleanup
Jun 16, 2026
Merged

fix: clean up RC tags for custom tag prefixes on publish#190
joshua-temple merged 1 commit into
mainfrom
fix/rc-tag-prefix-cleanup

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

When an rc is promoted to a full release, publish() calls cleanupRCTags() to delete the superseded RC git tags. parseRCTag hardcoded the v prefix (^(v\d+\.\d+\.\d+)-rc\.(\d+)$), so a repo using a custom tag_prefix (e.g. rel-) produced RC tags like rel-0.1.0-rc.0 that failed the regex. Cleanup skipped them, leaving stale RC tags after publish.

Fix

parseRCTag / isRCTag are now prefix-aware. The base-version capture includes the prefix (^(.*\d+\.\d+\.\d+)-rc\.(\d+)$), so the value compares directly against the published release tag without reconstructing the prefix. The default v, custom prefixes (rel-, release/), and the empty prefix all parse. The $ anchor keeps hotfix-shaped tags (...-rc.N.hotfix.M) inert, and cleanup still only deletes RC tags whose prefixed base matches the published version.

Verification

  • TestParseRCTag extended with custom-prefix, empty-prefix, hotfix, and non-numeric cases.
  • New TestManager_Publish_CustomTagPrefix: publishing rel-0.1.0 deletes rel-0.1.0-rc.0/1, while rel-0.2.0-rc.0 (different base) and v0.1.0-rc.0 (different prefix) survive.
  • go build ./... && go test ./... && golangci-lint run ./... green.

The RC git-tag cleanup path is GitHub-only (gated by isGitHubHost); the Gitea e2e backend lacks the git-data refs API, so a Gitea e2e scenario would not exercise it. Coverage is the targeted unit test plus the real-GitHub validation fleet.

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple joshua-temple merged commit d294cb0 into main Jun 16, 2026
9 checks passed
@joshua-temple joshua-temple deleted the fix/rc-tag-prefix-cleanup branch June 16, 2026 18:33
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.

1 participant