From 3b6c78a1e57d3455733f55e72f597c03587e96d5 Mon Sep 17 00:00:00 2001 From: "Ya-wen, Jeng" Date: Mon, 18 Aug 2025 10:07:08 +0800 Subject: [PATCH] chore: bump version to 0.1.3 and add GitHub Actions workflow for crate publishing --- .github/workflows/release.yml | 49 +++++++++++++++++++++++++++++++++++ Cargo.lock | 2 +- crates/Cargo.toml | 2 +- 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ec26cd1 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/Cargo.lock b/Cargo.lock index 4c6ac69..ce1e5ec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -91,7 +91,7 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "rust-rapidsnark" -version = "0.1.2" +version = "0.1.3" dependencies = [ "anyhow", "cc", diff --git a/crates/Cargo.toml b/crates/Cargo.toml index a479dbe..7a7170a 100644 --- a/crates/Cargo.toml +++ b/crates/Cargo.toml @@ -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"