ci: keep v1 major tag floating to latest release - #5
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe new GitHub Actions workflow runs on version-tag pushes. It validates stable semantic-version tags, selects the newest release for the major version, and force-updates the major tag only when the triggering release is newest. ChangesRelease tag management
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant GitHub
participant ReleaseWorkflow
participant GitTags
GitHub->>ReleaseWorkflow: Trigger on version-tag push
ReleaseWorkflow->>GitTags: Read stable release tags
ReleaseWorkflow->>ReleaseWorkflow: Select newest release for the major
ReleaseWorkflow->>GitTags: Force-push major tag when trigger is newest
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
bump actions to latest
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/release.yml:
- Around line 8-9: Set workflow-level permissions to an empty permission set,
then add contents: write only to the move-major-tag job. Keep the job’s existing
behavior unchanged while ensuring no other jobs inherit repository write access.
- Around line 19-23: Update the release workflow around the MAJOR tag update to
fetch remote tags first, identify the greatest stable semantic-version tag
matching the current major, and use that selected tag as the target for git tag
and push operations. Ensure an older triggering TAG cannot move the major tag
backward, while preserving the existing version-pattern validation.
- Around line 3-6: Add a workflow-level concurrency group to the release
workflow triggered by the v* tag push, using a shared key derived from the major
version rather than the full patch tag, so updates to the same major tag are
serialized and do not move backward.
- Around line 19-24: Update the version-matching condition in the release
workflow to reject leading zeroes in all semantic-version components, allowing
only 0 or a nonzero digit followed by digits for major, minor, and patch. Keep
the existing tag extraction and major-tag push behavior unchanged for valid
tags.
- Line 15: Update the actions/checkout workflow step to reference its resolved
full-length commit SHA instead of the mutable v7 tag, while retaining “# v7” as
a readability comment.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: d88a888f-7d51-4102-a867-fcfc8aa01a6e
📒 Files selected for processing (1)
.github/workflows/release.yml
Five things CodeRabbit flagged, all real: Least privilege. The workflow granted contents: write to everything; now nothing gets it by default and only the one job that pushes a tag asks for it. No walking backward. The job moved the major onto whatever tag fired it, so re-pushing an old v1.0.0 would have dragged v1 back off v1.0.1. It now picks the greatest stable tag in the series and does nothing if that is not the tag that triggered the run. No leading zeroes. v01.0.1 matched the old pattern and would have produced a v01 major tag. Serialized. Two tag pushes can no longer both decide where the same major belongs. Pinned. actions/checkout rides a SHA rather than the mutable v7.
Adds a workflow that keeps the floating major version tag (
v1) pointing at the latestv1.x.yrelease.What it does
v*tag.vX.Y.Z(strict semver), moves the major tag (v1) to that commit and force-pushes it.Why
The
v1tag had gone stale — it still pointed at thev1.0.0commit afterv1.0.1was released — so consumers pinning@v1were silently on the old version. This prevents that from recurring. Pre-release tags (e.g.v1.0.1-rc.1) do not move the major tag.Summary by CodeRabbit