Crates.io | auto-release |
lib.rs | auto-release |
version | 0.5.1 |
source | src |
created_at | 2024-01-21 16:36:17.457002 |
updated_at | 2024-06-27 15:39:33.450952 |
description | Command-line utility for automatically releasing Rust code |
homepage | |
repository | https://github.com/nicholasbishop/release-utils-rs |
max_upload_size | |
id | 1107719 |
size | 25,990 |
This package provides an executable that can be run from Github Actions to release code to crates.io and pushing a git tag.
All code changes needed for a release are made by a developer in a
regular git commit. The commit includes bumping the version in
Cargo.toml
, and any updates to Cargo.lock
, changelog files, etc. The
commit is reviewed and merged through the normal pull request
process. Once merged, a Github Actions job runs auto-release
to
actually push the release.
Releasing this way has a couple advantages over local release flows:
Create a Github Actions workflow, e.g. .github/workflows/release.yaml
:
on:
push:
branches:
- main
name: Release
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: cargo install auto-release
- run: auto-release -p <package>
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
The auto-release
crate has minimal compile-time dependencies, so it
compiles very quickly. It does rely on various programs being available,
all of which are already installed and configured on Github's Ubuntu
runners:
cargo
curl
gh
git
jq
Generate the cargo registry token in your crates.io Account
Settings. The token scopes must include publish-update
. If the crate
has never been published before, publish-new
is also required.
To make the token available to the Github Actions workflow:
Secrets and variables
in the sidebar, then click Actions
Repository secrets
, click New repository secret
.-p
/--package
can be specified multiple times to release multiple
packages. Note that order may be significant if packages depend on
each other.--condition body
adds a condition that the commit message body must
start with "release:", otherwise the commit will be ignored.--condition subject
adds a condition that the commit message subject
must start with "release:", otherwise the commit will be ignored.Licensed under either of Apache License, Version 2.0 or MIT license at your option.
See the code of conduct and contributing.md.
This project is not an official Google project. It is not supported by Google and Google specifically disclaims all warranties as to its quality, merchantability, or fitness for a particular purpose.