This repository contains extremely opinionated reusable GitHub Actions workflows providing CI and CD for Rust projects.
This GitHub Action is intended to reduce duplication among very rigidly organized projects. These are not general-purpose workflows. You may find that they work for you and your development workflows out of the box, or they may not.
Continuous deployments brought to you by semantic-release.
Continuous integration is provided by .github/workflows/ci.yml
.
CI runs Rust tests on an ubuntu-latest
runner.
---
name: CI
on:
pull_request:
jobs:
test:
uses: semantic-release-action/rust/.github/workflows/ci.yml@v5
Input Parameter | Default | Description |
---|---|---|
toolchain | stable |
Rust toolchain specification. Details |
submodules | false |
Whether to checkout submodules. Details |
Specify a Rust toolchain.
Whether to checkout submodules. Use true
to checkout submodules or recursive
to recursively checkout submodules.
This option is passed verbatim to actions/checkout, see its documentation for more details.
Continuous deployments for Rust binaries are provided by .github/workflows/release-binary.yml
.
Each deploy:
-
publishes your crate to crates.io
This provides compatibility with cargo binstall.
-
creates or updates git tags
Tags are of the format
v1.2.3
,v1.2
, andv1
. -
uploads precompiled release binaries to the associated GitHub Release
-
updates a CHANGELOG.md in your git repository
This produces a commit (currently not gpg signed).
---
name: Release
on:
push:
branches:
- master
- next
- next-major
- beta
- alpha
- "[0-9]+.[0-9]+.x"
- "[0-9]+.x"
jobs:
release:
uses: semantic-release-action/rust/.github/workflows/release-binary.yml@v5
secrets:
cargo-registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
Input Parameter | Default | Description |
---|---|---|
targets | all supported | Whitelist of compilation targets to upload GitHub release binaries for. Details |
toolchain | stable |
Rust toolchain specification. Details |
disable-semantic-release-cargo | false |
Disable semantic-release-cargo in your release flow. Details |
disable-semantic-release-git | false |
Disable @semantic-release/git in your release flow. Details |
submodules | false |
Whether to checkout submodules. Details |
Whitelist of compilation targets to upload GitHub release binaries for. Must be a subset of supported targets:
- aarch64-apple-darwin
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- i686-unknown-linux-gnu
- i686-unknown-linux-musl
- x86_64-apple-darwin
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
Separate each target with whitespace:
jobs:
release:
uses: semantic-release-action/rust/.github/workflows/release-binary.yml@v5
with:
targets: |
aarch64-apple-darwin
x86_64-apple-darwin
x86_64-unknown-linux-musl
secrets:
cargo-registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
Runtime option controlling the use of semantic-release-cargo.
Set to true
to prevent semantic-release from publishing your crate to the configured cargo registry.
Runtime option controlling the use of @semantic-release/git.
Set to true
to prevent semantic-release from pushing artifacts to your repository.
This may be required with certain repository settings, for example when requiring signed commits.
Secret | Required | Description |
---|---|---|
cargo-registry-token | false | Cargo registry API token. Details |
API token with write permission for publishing your crate to your target registry.
Continuous deployments for Rust libraries are provided by .github/workflows/release-library.yml
.
Each deploy:
-
publishes your crate to crates.io
This provides compatibility with cargo binstall.
-
updates a CHANGELOG.md in your git repository
This produces a commit (currently not gpg signed).
---
name: Release
on:
push:
branches:
- master
- next
- next-major
- beta
- alpha
- "[0-9]+.[0-9]+.x"
- "[0-9]+.x"
jobs:
release:
uses: semantic-release-action/rust/.github/workflows/release-library.yml@v5
secrets:
cargo-registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
Input Parameter | Default | Description |
---|---|---|
toolchain | stable |
Rust toolchain specification. Details |
disable-semantic-release-cargo | false |
Disable semantic-release-cargo in your release flow. Details |
disable-semantic-release-git | false |
Disable @semantic-release/git in your release flow. Details |
submodules | false |
Whether to checkout submodules. Details |
Secret | Required | Description |
---|---|---|
cargo-registry-token | false | Cargo registry API token. Details |