name: release
on:
push:
tags:
- "v*"
defaults:
run:
shell: bash
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: -Dwarnings
jobs:
test:
uses: ./.github/workflows/ci.yml
with:
release: true
publish:
runs-on: ubuntu-latest
needs: test
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-stable-${{ hashFiles('**/Cargo.lock') }}
- name: Set up toolchain
run: rustup install
- name: Authenticate with crates.io
id: auth
uses: rust-lang/crates-io-auth-action@v1
- name: Release
run: gh release create ${{ github.ref_name }} --generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}