Skip to content

Add moving major branch publishing - #30

Merged
bcomnes merged 1 commit into
masterfrom
feature/publish-major-branch
Sep 3, 2026
Merged

bcomnes merged 1 commit into
masterfrom
feature/publish-major-branch

Conversation

@bcomnes

@bcomnes bcomnes commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • add opt-in goversion publish -major-branch
  • derive and publish the moving vN GitHub Actions branch after all other release stages succeed
  • protect updates with force-with-lease and support dry-run, reuse, resume, and configured remotes
  • expose library metadata and CLI status output
  • document the workflow and add unit plus bare-remote integration coverage

Validation

  • go test ./...
  • go vet ./...
  • git diff --check

Follow-up

After this is released, go-bump can update its pinned goversion dependency and self-host releases with major-branch: true.

@bcomnes
bcomnes requested a lite review from Copilot September 3, 2026 18:20
@bcomnes
bcomnes merged commit 4428bd6 into master Sep 3, 2026
11 checks passed
@bcomnes
bcomnes deleted the feature/publish-major-branch branch September 3, 2026 18:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The major-branch publish path mutates local refs via git update-ref, which can unexpectedly overwrite an existing local vN branch and should be adjusted to avoid destructive local side effects.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR adds an opt-in “moving major branch” publish stage that updates a vN branch (for example v2) for GitHub Actions consumers only after the existing publish stages succeed.
It extends the publish CLI and library metadata/status reporting, documents the workflow, and adds unit plus local-remote integration coverage.

Changes:

  • Add goversion publish -major-branch to optionally publish/advance the moving vN branch after refs, release, and proxy stages.
  • Expose moving major-branch metadata and status in PublishMeta and CLI output.
  • Add README documentation and tests covering dry-run, lease behavior, reuse, and advancement.
File summaries
File Description
README.md Documents the new -major-branch publish stage and its semantics (opt-in, post-success, force-with-lease).
publish_cli.go Adds the -major-branch flag, wires it into PublishOptions, and prints major-branch step status.
publish_cli_test.go Extends CLI help and local-remote publish integration coverage to include the moving major branch behavior.
pkg/publish.go Adds PublishOptions.MajorBranch, new PublishMeta fields/status, and sequences the major-branch stage after proxy seeding.
pkg/publish_git.go Implements preflight inspection and publishing logic for the moving major branch using force-with-lease and verification.
pkg/publish_major_branch_test.go Adds unit tests for major-branch dry-run, advancement, reuse, and resumable lease failure behavior.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/publish_git.go
Comment on lines +124 to +128
updateArgs := []string{"update-ref", ref, meta.HeadCommit}
if output, err := runner.Run(workDir, nil, "git", updateArgs...); err != nil {
return publishCommandError("update local moving major branch "+meta.MajorBranch, output, err, "git", updateArgs...)
}
pushArgs := []string{"push", lease, meta.Remote, ref + ":" + ref}
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.

2 participants