Skip to content

Add Cargo Publish workflow #1

Add Cargo Publish workflow

Add Cargo Publish workflow #1

Workflow file for this run

name: 📦 Cargo Publish
on:
push:
branches-ignore: [wip/**]
jobs:
test:
name: 📦 Cargo Publish
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
run: |
v="v$(grep "^version" Cargo.toml | sed -r 's/version[^"]+"([^"]+).*/\1/')"
if [ "v" != "$GITHUB_OUTPUT" ]; then
printf "Cargo.toml version %s does not match tag %s" "$v" "$GITHUB_OUTPUT"
exit 2
fi
# cargo publish
if: startsWith( github.ref, 'refs/tags/v' )