ci: Release libtortillas to crates.io on merge to main branch #144
ci: Release libtortillas to crates.io on merge to main branch #144artrixdotdev merged 8 commits intomainfrom
libtortillas to crates.io on merge to main branch #144Conversation
WalkthroughAdds a prerelease "Publish Prerelease" GitHub Actions workflow, makes the CI checks workflow callable via Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant GH as GitHub
participant ReleaseWF as .github/workflows/release.yml
participant ChecksWF as .github/workflows/checks.yml
participant Cargo as crates.io / cargo
Dev->>GH: Push to main (Cargo.toml / .rs changes)
GH->>ReleaseWF: trigger "Publish Prerelease"
rect rgba(200,220,255,0.25)
note right of ReleaseWF: Run CI gate
ReleaseWF->>ChecksWF: workflow_call (run checks)
ChecksWF-->>ReleaseWF: status (success/failure)
end
alt checks succeed
ReleaseWF->>ReleaseWF: derive BASE_VERSION (cargo pkgid)
ReleaseWF->>ReleaseWF: compute PRERELEASE_VERSION = BASE_VERSION-alpha.<7-char SHA>
ReleaseWF->>ReleaseWF: cargo set-version -p libtortillas --no-workspace
ReleaseWF->>Cargo: cargo package && cargo publish (with CARGO_REGISTRY_TOKEN)
Cargo-->>ReleaseWF: publish result
else checks fail
ReleaseWF-->>GH: workflow fails
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
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: 4
🧹 Nitpick comments (2)
crates/libtortillas/Cargo.toml (1)
6-6: Fix grammar and capitalization in description.Use “An asynchronous” and capitalize “BitTorrent.”
Apply:
-description = "A asynchronous library based on the actor model for interacting with the bittorrent protocol" +description = "An asynchronous library based on the actor model for interacting with the BitTorrent protocol".github/workflows/release.yml (1)
17-19: Consider concurrency control to avoid overlapping publishes.Back-to-back merges could race; serialize by ref.
Add:
concurrency: group: prerelease-${{ github.ref }} cancel-in-progress: false
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.github/workflows/checks.yml(1 hunks).github/workflows/release.yml(1 hunks)crates/libtortillas/Cargo.toml(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/checks.yml
40-40: the runner of "actions-rs/cargo@v1" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🔇 Additional comments (4)
crates/libtortillas/Cargo.toml (1)
7-9: Metadata looks good for crates.io..github/workflows/checks.yml (1)
3-9: Trigger strategy makes sense.Disabling push-to-main here and invoking via reusable workflow is fine given release.yml calls it.
.github/workflows/release.yml (2)
3-11: Confirm trigger scope.This publishes on any Rust/Cargo change anywhere in the repo. If you intend to publish only when libtortillas changes, narrow paths to
crates/libtortillas/**.Suggested tweak:
- paths: - - "**/Cargo.toml" - - "**/Cargo.lock" - - "**/*.rs" + paths: + - "crates/libtortillas/**"
41-43: Ensure CARGO_REGISTRY_TOKEN is set in repo secrets.Without it, publish will fail. Also validate crates.io ownership for libtortillas.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This PR intends to publish an
alphatagged release to https://crates.io on every merge to the main branch. Before this PR can be merged, a refactor needs to be implemented onto thePeerIdstruct to strip the text and commit hash from the VERSION before it is used to create a PeerId, otherwise we would be breaking thePeerIdFormat::Azureusspec.See #145
Possible related issues:
Summary by CodeRabbit
New Features
Documentation
Chores