ci(release): automate GitHub releases from Cargo.toml version bumps#80
ci(release): automate GitHub releases from Cargo.toml version bumps#80
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe PR replaces a tag-driven release workflow with a version-bump-driven automation that validates strict X.Y.Z in Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer (push/PR)
participant Actions as GitHub Actions (release.yml)
participant Repo as Git Repository
participant GH as GitHub Releases API
participant Dist as cargo-dist
rect rgba(100,150,250,0.5)
Dev->>Repo: push commit or open PR (Cargo.toml change?)
end
Actions->>Actions: release_meta: read Cargo.toml → version "X.Y.Z", tag "vX.Y.Z"
Actions->>GH: query Releases/tags for "vX.Y.Z"
alt tag exists OR no version bump
GH-->>Actions: tag found (published/draft)
Actions->>Actions: set publishing=false
Actions->>Dist: run `dist plan` (no publish)
else new version & tag not published
GH-->>Actions: tag not found
Actions->>Actions: set publishing=true
Actions->>Dist: run `dist host --steps=create --tag="vX.Y.Z"` (publish)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/release.yml:
- Around line 12-16: The workflow currently only triggers on pushes to branches:
main/master with a paths filter for Cargo.toml which prevents retrying a failed
release for the same version; update .github/workflows/release.yml to remove or
relax the paths: - Cargo.toml restriction and add an explicit workflow_dispatch
trigger (and/or push:on: tags) so you can re-run or re-trigger the release
without a version bump, and ensure any existing guard logic that compares
github.event.before to the new version is adjusted to allow manual re-run
(references: branches, paths, Cargo.toml, workflow_dispatch).
- Around line 63-80: The release version format check currently runs only on
push (using EVENT_NAME, BEFORE_SHA, previous_version and current_version), so
add the same X.Y.Z validation as an earlier CI step that runs on pull_request
(or include it in existing PR workflows) to reject non-semver variants before
merge; implement this by extracting current_version from Cargo.toml and applying
the same regex check (^[0-9]+\.[0-9]+\.[0-9]+$) in a PR-checking job so PRs that
set versions like 1.2.3-rc.1 fail CI instead of only failing after merge.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3631e036-1761-4bcf-af6a-c77329a20680
📒 Files selected for processing (2)
.github/workflows/release.ymlRELEASE.md
|
🧠 Learnings used✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
🧹 Nitpick comments (2)
.github/workflows/ci.yml (2)
33-37: MakeCargo.tomlversion parsing whitespace-tolerant to prevent brittle CI failures.Current matching depends on exact formatting (
[package]andversion =). A small formatting variation can cause false negatives.Diff suggestion
- current_version="$( - awk ' - /^\[package\]$/ { in_package = 1; next } - /^\[/ { in_package = 0 } - in_package && /^version = / { print $3; exit } - ' Cargo.toml | tr -d '"' - )" + current_version="$( + awk ' + /^[[:space:]]*\[package\][[:space:]]*$/ { in_package = 1; next } + /^[[:space:]]*\[/ { in_package = 0 } + in_package && /^[[:space:]]*version[[:space:]]*=/ { + if (match($0, /"([^"]+)"/, m)) { print m[1]; exit } + } + ' Cargo.toml + )"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/ci.yml around lines 33 - 37, The AWK snippet that extracts the version uses exact patterns (/^\[package\]$/, /^\[/, and /^version = /) which are brittle; update the patterns to be whitespace-tolerant (e.g., /^\s*\[package\]\s*$/, /^\s*\[/, and /^\s*version\s*=\s*/) so the in_package logic and the version match work with varying spacing, and keep the existing | tr -d '"' to strip quotes after extraction (locate the awk block containing in_package and the version match).
19-21: Gate downstream jobs onversionto fail fast and save runners.
rustandgitleakscan still run even when version validation already failed.Diff suggestion
rust: name: Rust Checks + needs: version runs-on: ubuntu-latest @@ gitleaks: name: Secret Scan + needs: version runs-on: ubuntu-latest🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/ci.yml around lines 19 - 21, The CI currently lets downstream jobs run even if the version job fails; update the workflow so downstream jobs depend on the version job by adding an explicit dependency for the failing-fast behavior: add needs: version (or conditional `if: needs.version.result == 'success'`) to the rust and gitleaks jobs (and any other jobs that should be gated) in .github/workflows/ci.yml so they only run when the Version Checks job (job name `version`) succeeds.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 33-37: The AWK snippet that extracts the version uses exact
patterns (/^\[package\]$/, /^\[/, and /^version = /) which are brittle; update
the patterns to be whitespace-tolerant (e.g., /^\s*\[package\]\s*$/, /^\s*\[/,
and /^\s*version\s*=\s*/) so the in_package logic and the version match work
with varying spacing, and keep the existing | tr -d '"' to strip quotes after
extraction (locate the awk block containing in_package and the version match).
- Around line 19-21: The CI currently lets downstream jobs run even if the
version job fails; update the workflow so downstream jobs depend on the version
job by adding an explicit dependency for the failing-fast behavior: add needs:
version (or conditional `if: needs.version.result == 'success'`) to the rust and
gitleaks jobs (and any other jobs that should be gated) in
.github/workflows/ci.yml so they only run when the Version Checks job (job name
`version`) succeeds.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1897a984-dc4d-4814-93aa-f858073338ba
📒 Files selected for processing (6)
.github/dependabot.yml.github/workflows/ci.yml.github/workflows/release.ymlRELEASE.mdrust-toolchain.tomlsrc/launch.rs
✅ Files skipped from review due to trivial changes (3)
- rust-toolchain.toml
- .github/dependabot.yml
- src/launch.rs
🚧 Files skipped from review as they are similar to previous changes (2)
- RELEASE.md
- .github/workflows/release.yml
|
✅ Actions performedReview triggered.
|
Summary by CodeRabbit