Skip to content

Workflow file for this run

name: Publish release to Crates.io
concurrency:
group: ${{ github.workflow }}
on:
push:
tags:
- '*'
env:
CARGO_TERM_COLOR: always
jobs:
build-test:
name: Build and test (${{ matrix.os }})
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: swatinem/rust-cache@v2
- name: Build
run: >
cargo build
--locked
--verbose
- name: Run tests (without coverage)
if: matrix.os != 'ubuntu-latest'
run: >
cargo test
--verbose
release-please:
name: Execute release chores
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
needs: build-test
outputs:
created: ${{ steps.release.outputs.release_created }}
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: rust
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
needs: release-please
if: needs.release-please.outputs.created
environment: crates.io
steps:
- uses: actions/checkout@v3
- uses: swatinem/rust-cache@v2
- name: Publish
# https://doc.rust-lang.org/cargo/reference/config.html?highlight=CARGO_REGISTRY_TOKEN#credentials
run: >
cargo publish
--verbose
--locked
--token ${{ secrets.CARGO_REGISTRY_TOKEN }}