chore: bump version to 0.1.3 and add GitHub Actions workflow for crate publishing

This commit is contained in:
Ya-wen, Jeng 2025-08-18 10:07:08 +08:00
parent 625b31132f
commit 3b6c78a1e5
3 changed files with 51 additions and 2 deletions

49
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,49 @@
name: Publish Crate
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: "1.89.0"
components: rustfmt
override: true
- name: Extract release version
id: version
run: |
TAG_VERSION="${GITHUB_REF#refs/tags/}"
# Strip leading 'v'
RELEASE_VERSION="${TAG_VERSION#v}"
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
- name: Check Cargo.toml version matches tag
run: |
CRATE_VERSION=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].version')
if [ "$CRATE_VERSION" != "$RELEASE_VERSION" ]; then
echo "❌ Cargo.toml version ($CRATE_VERSION) does not match release tag ($RELEASE_VERSION)"
exit 1
fi
- name: Check if version already published
run: |
CRATE_NAME=$(cargo metadata --no-deps --format-version=1 | jq -r '.packages[0].name')
if cargo search "^$CRATE_NAME$" --limit 1 | grep -q "$RELEASE_VERSION"; then
echo "❌ Version $RELEASE_VERSION already exists on crates.io"
exit 1
fi
- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish -p rust-rapidsnark

2
Cargo.lock generated
View File

@ -91,7 +91,7 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
[[package]]
name = "rust-rapidsnark"
version = "0.1.2"
version = "0.1.3"
dependencies = [
"anyhow",
"cc",

View File

@ -1,6 +1,6 @@
[package]
name = "rust-rapidsnark"
version = "0.1.2"
version = "0.1.3"
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/zkmopro/rust-rapidsnark"