This project uses cargo-release to automate the release workflow.
Cargo-release is already installed. The configuration is in release.toml.
Preview what will happen without making changes:
cargo release patchThis shows:
- Version bump (0.1.17 → 0.1.18)
- Files to be modified
- Git operations
- Publishing steps
Execute the full release workflow:
cargo release patch --executeThis automatically:
- ✅ Bumps version in
Cargo.toml - ✅ Runs tests:
cargo test - ✅ Runs formatting check:
cargo fmt --check - ✅ Updates
CHANGELOG.md - ✅ Publishes to crates.io
- ✅ Creates release commit:
"Release v0.1.18" - ✅ Creates Git tag:
v0.1.18 - ✅ Pushes commits and tags to remote
Bump to a specific version (major, minor, patch):
# Patch release (0.1.17 → 0.1.18)
cargo release patch --execute
# Minor release (0.1.17 → 0.2.0)
cargo release minor --execute
# Major release (0.1.17 → 1.0.0)
cargo release major --executeNote: Always specify a version level (patch/minor/major). Running cargo release without a level will try to re-release the current version.
If you want to skip publishing:
cargo release patch --execute --no-publishFor testing/staging:
cargo release patch --execute --no-push- Cargo.toml: Version number
- CHANGELOG.md: New release section (if properly configured)
- Git: Creates commit and annotated tag
- Commit message:
"Release vX.Y.Z" - Includes: version bumps and CHANGELOG updates
- Tag name:
vX.Y.Z(e.g.,v0.1.18) - Tag message:
"Release vX.Y.Z" - Annotated tag for better tracking
Ensure:
- ✅ All changes are committed:
git status - ✅ Tests pass:
cargo test - ✅ Code is formatted:
cargo fmt - ✅ You have push access to the remote repository
- ✅ crates.io credentials are configured (for publishing)
If this is your first time publishing to crates.io:
# Login to crates.io (interactive)
cargo login
# This creates/updates ~/.cargo/credentials.tomlThe release process is configured in release.toml:
- changelog: Automatically update CHANGELOG.md
- git.push: Push commits and tags to remote
- git.tag-name: Tag format (v{{version}})
- publish: Publish to crates.io
# Step 1: Verify nothing to commit
$ git status
On branch main
nothing to commit
# Step 2: Preview the release
$ cargo release --dry-run
Prepared release of sofos v0.1.18
# Step 3: Execute release
$ cargo release patch --execute
Releasing sofos v0.1.18
- Bump version in Cargo.toml
- Run pre-release checks
- Update CHANGELOG.md
- Publish to crates.io
- Create release commit
- Create git tag v0.1.18
- Push to remote
# Step 4: Verify on GitHub
$ git tag
v0.1.17
v0.1.18 ← New tag
# Step 5: Verify on crates.io
# https://crates.io/crates/sofosYou need new commits since the last tag:
git log v0.1.17..HEADCheck crates.io credentials:
cargo loginAll changes must be committed before release:
git status
git add .
git commit -m "message"Ensure you have push access:
git push origin main # Test pushTo have cargo-release automatically update CHANGELOG.md with conventional commit messages, ensure your commit messages follow the format:
feat: add new feature
fix: fix bug
docs: update documentation
refactor: refactor code
Then release will automatically categorize them in CHANGELOG.md.
If something goes wrong:
# Undo the last commit
git reset --soft HEAD~1
# Delete the tag locally
git tag -d v0.1.18
# Delete the tag remotely
git push origin :refs/tags/v0.1.18