Repository navigation
Add moving major branch publishing - #30
Conversation
There was a problem hiding this comment.
🟡 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-branchto optionally publish/advance the movingvNbranch after refs, release, and proxy stages. - Expose moving major-branch metadata and status in
PublishMetaand 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.
| 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} |
Summary
goversion publish -major-branchvNGitHub Actions branch after all other release stages succeedValidation
go test ./...go vet ./...git diff --checkFollow-up
After this is released, go-bump can update its pinned goversion dependency and self-host releases with
major-branch: true.