Skip to content

Commit

Permalink
Add Cargo Publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
theory committed Aug 5, 2024
1 parent d7cf3ba commit f7415f9
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/cargo-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
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' )

0 comments on commit f7415f9

Please sign in to comment.