Add clean make target #311
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 📦 Cargo Publish | |
on: | |
push: | |
branches-ignore: [wip/**] | |
tags: ["**"] | |
pull_request: | |
jobs: | |
test: | |
name: 📦 Cargo ${{ startsWith(github.ref, 'refs/tags') && 'Publish' || 'Package' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Rust Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: { toolchain: stable } | |
- name: Package | |
run: cargo publish --dry-run | |
- name: Publish | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
run: | | |
v="v$(grep "^version" Cargo.toml | sed -r 's/version[^"]+"([^"]+).*/\1/')" | |
if [ "$v" != "$GITHUB_REF_NAME" ]; then | |
printf "Cargo.toml version %s does not match tag %s\n" "$v" "$GITHUB_REF_NAME" >&2 | |
exit 1 | |
fi | |
cargo publish | |
if: startsWith( github.ref, 'refs/tags/v' ) |