Skip to content

chore: release v0.1.3 #3

chore: release v0.1.3

chore: release v0.1.3 #3

Workflow file for this run

name: Release crates.io
on:
push:
tags:
- "v*"
permissions:
contents: read
env:
CARGO_HTTP_MULTIPLEXING: "false"
concurrency:
group: crates-${{ github.ref }}
cancel-in-progress: false
jobs:
publish:
name: Publish crate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@1.89.0
with:
components: clippy, rustfmt
- name: Verify tag matches crate version
shell: bash
run: |
set -euo pipefail
version="$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "cliare") | .version')"
tag="${GITHUB_REF_NAME#v}"
if [[ "$tag" != "$version" ]]; then
echo "Tag v${tag} does not match Cargo.toml version ${version}."
exit 1
fi
- name: Format
run: cargo fmt --all -- --check
- name: Clippy
run: env RUSTC_WRAPPER= cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: Test
run: cargo test --workspace --all-features
- name: Package
run: cargo package --list
- name: Verify crates.io token is configured
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
shell: bash
run: |
set -euo pipefail
if [[ -z "${CARGO_REGISTRY_TOKEN}" ]]; then
echo "Missing CARGO_REGISTRY_TOKEN repository secret."
exit 1
fi
- name: Publish dry run
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish --dry-run
- name: Publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish