Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump version of aligned-sized to 0.1.1 #9

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ on:
- light-macros
- light-merkle-tree-event
- light-merkle-tree-reference
- light-protocol
- light-registry
- light-test-utils
- light-user-registry
- light-utils
- light-wasm-hasher
- account-compression
Expand Down Expand Up @@ -51,14 +50,26 @@ jobs:
toolchain: stable

- name: Install cargo-release
shell: bash
run: |
VERSION="$(curl --silent "https://api.github.com/repos/crate-ci/cargo-release/releases/latest" | jq -r .tag_name)"
pushd /tmp
wget https://github.com/crate-ci/cargo-release/releases/download/"$VERSION"/cargo-release-"$VERSION"-x86_64-unknown-linux-gnu.tar.gz
tar -xzvf cargo-release-"$VERSION"-x86_64-unknown-linux-gnu.tar.gz --wildcards '*cargo-release' --strip-components=1
cp cargo-release "$HOME"/.cargo/bin
popd

- uses: cargo-bins/release-pr@v2
- name: Bump crate version
run: |
cargo release version --execute --no-confirm \
-p "${{ inputs.crate }}" "${{ inputs.version }}"

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
env:
COMMIT_MESSAGE: "chore: bump version of ${{ inputs.crate }} to ${{ inputs.version }}"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: ${{ inputs.version }}
crate-name: ${{ inputs.crate }}
commit-message: ${{ env.COMMIT_MESSAGE }}
title: ${{ env.COMMIT_MESSAGE }}
branch: "bump-${{ inputs.crate }}-to-${{ inputs.version }}"
labels: "version bump"
67 changes: 67 additions & 0 deletions .github/workflows/release-pr-ts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Open a TypeScript release PR
on:
workflow_dispatch:
inputs:
package:
description: Package to release
required: true
type: choice
options:
- circuit-lib.js
- cli
- compressed-token
- prover.js
- stateless.js
version:
description: Version to release
required: true
type: string

jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 8
run_install: false

- name: Install dependencies
run: pnpm install

- name: Determine the subdirectory
id: subdir
run: |
PROJECT_NAME="${{ inputs.package }}"
if [[ "$PROJECT_NAME" == *"circuit-lib.js"* ]]; then
SUBDIR="circuit-lib/circuit-lib.js"
elif [[ "$PROJECT_NAME" == *"cli"* ]]; then
SUBDIR="cli"
elif [[ "$PROJECT_NAME" == *"compressed-token"* ]]; then
SUBDIR="js/compressed-token"
elif [[ "$PROJECT_NAME" == *"prover.js"* ]]; then
SUBDIR="prover.js"
elif [[ "$PROJECT_NAME" == *"stateless.js"* ]]; then
SUBDIR="js/stateless.js"
fi
echo "subdir='$SUBDIR'" >> "$GITHUB_OUTPUT"

- name: Bump package version
run: |
cd ${{ steps.subdir.outputs.subdir }}
pnpm version ${{ inputs.version }}

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
env:
COMMIT_MESSAGE: "chore: bump version of ${{ inputs.package }} to ${{ inputs.version }}"
with:
commit-message: ${{ env.COMMIT_MESSAGE }}
title: ${{ env.COMMIT_MESSAGE }}
branch: "bump-${{ inputs.package }}-to-${{ inputs.version }}"
labels: "version bump"

142 changes: 101 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,132 @@
name: Release programs
name: Release

on:
push:
tags:
- "*"

permissions:
contents: write
branches:
- main

jobs:
build:
auto-tag:
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: true

- name: Setup and build
uses: ./.github/actions/setup-and-build
- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 8
run_install: false

- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable

- name: Extract version
id: version
shell: bash
run: |
set -eux

function rust_version() {
cargo pkgid -p $1 | cut -d "@" -f2
}

function ts_version() {
pnpm list --filter $1 --depth 0 --json | jq -r '.[0].version'
}

COMMIT_MESSAGE=$(git log -1 --pretty=format:'%s')
PACKAGE=""
VERSION=""
LANGUAGE=""

if [[ "$COMMIT_MESSAGE" == *"bump version of"* ]]; then
PACKAGE=$(echo "$COMMIT_MESSAGE" | grep -o "bump version of [^ ]*" | cut -d " " -f4)

if [[ -n "$PACKAGE_NAME" ]]; then
# First try getting the Rust version.
VERSION=$(rust_version "$PACKAGE_NAME")
LANGUAGE="rust"
if [[ -z "$VERSION" ]]; then
# If no version was found, try the TypeScript version.
VERSION=$(ts_version "$PACKAGE_NAME")
LANGUAGE="ts"
fi
fi

if [[ -z "$VERSION" ]] || [[ -z "$LANGUAGE" ]]; then
echo "Could not detect the version ($VERSION) or language ($LANGUAGE) of project $PROJECT"
fi
fi

echo "package=$PACKAGE" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "language=$LANGUAGE" >> "$GITHUB_OUTPUT"

- name: Extract crate name from tag
id: extract-crate
- name: Tag
id: tag
if: ${{ steps.version.outputs.version }}
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
TAG_NAME="${GITHUB_REF#refs/tags/}"
CRATE_NAME="$(echo "$TAG_NAME" | rev | cut -d'-' -f2- | rev)"
echo "Creating tag for package: $PACKAGE_NAME v$VERSION"

if [[ "$CRATE_NAME" == *"account-compression"* ]]; then
NEW_TAG="v$VERSION"
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git tag "${PACKAGE_NAME}-${NEW_TAG}"
git push origin "${PACKAGE_NAME}-${NEW_TAG}"

- name: Release Rust
if: ${{ steps.version.outputs.language }} == "rust"
shell: bash
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
PACKAGE: ${{ steps.version.outputs.package }}
run: |
# Check whether we are building an on-chain program. If yes, prepare
# an artifact.
ARTIFACT=""
if [[ "$ARTIFACT" == *"account-compression"* ]]; then
ARTIFACT="account_compression.so"
elif [[ "$CRATE_NAME" == *"light-compressed-pda"* ]]; then
elif [[ "$ARTIFACT" == *"light-compressed-pda"* ]]; then
ARTIFACT="light_compressed_pda.so"
elif [[ "$CRATE_NAME" == *"light-compressed-token"* ]]; then
elif [[ "$ARTIFACT" == *"light-compressed-token"* ]]; then
ARTIFACT="light_compressed_token.so"
elif [[ "$CRATE_NAME" == *"light-user-registry"* ]]; then
elif [[ "$ARTIFACT" == *"light-user-registry"* ]]; then
ARTIFACT="light_user_registry.so"
elif [[ "$CRATE_NAME" == *"light-registry"* ]]; then
elif [[ "$ARTIFACT" == *"light-registry"* ]]; then
ARTIFACT="light_registry.so"
fi
echo "crate=$CRATE_NAME" >> "$GITHUB_OUTPUT"
echo "artifact=$ARTIFACT" >> "$GITHUB_OUTPUT"
if [[ -n "$ARTIFACT" ]]; then
anchor build -p "$PACKAGE"
fi

- name: Prepare artifacts
cargo publish \
-p "${{ steps.extract-crate.outputs.crate }}" \
--token "$CARGO_REGISTRY_TOKEN"

- name: Release TypeScript
if: ${{ steps.version.outputs.language }} == "ts"
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
NPM_CONFIG_PROVENANCE: true
PACKAGE: ${{ steps.version.outputs.package }}
run: |
if [[ "$CRATE_NAME" == *"account-compression"* ]]; then
cp target/deploy/account_compression.so .
elif [[ "$CRATE_NAME" == *"light-compressed-pda"* ]]; then
cp target/deploy/light_compressed_pda.so .
elif [[ "$CRATE_NAME" == *"light-compressed-token"* ]]; then
cp target/deploy/light_compressed_token.so .
elif [[ "$CRATE_NAME" == *"light-user-registry"* ]]; then
cp target/deploy/light_user_registry.so .
elif [[ "$CRATE_NAME" == *"light-registry"* ]]; then
cp target/deploy/light_registry.so .
fi
SUBDIR=$(grep "$PACKAGE" pnpm-workspace.yaml | awk -F '"' '{gsub("/\\*\\*", "", $2); print $2}')
cd "$SUBDIR"
pnpm publish --access public --no-git-checks

- name: Release
- name: GitHub release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
token: ${{ secrets.PAT_TOKEN }}
files: |
"${{ steps.extract-crate.outputs.artifact }}"

- name: Run cargo publish
# Skip macro-circom, it has a git dependency preventing it from publishing.
if: steps.extract-crate.outputs.crate != 'macro-circom'
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
run: |
cargo publish -p "${{ steps.extract-crate.outputs.crate }}" --token "$CARGO_REGISTRY_TOKEN"
51 changes: 0 additions & 51 deletions .github/workflows/tag.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions circuit-lib/circuitlib-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
[package]
name = "light-circuitlib-rs"
version = "0.1.0"
description = "Crate for interacting with Light Protocol circuits"
repository = "https://github.com/Lightprotocol/light-protocol"
license = "Apache-2.0"
edition = "2021"

[features]
gnark = ["tokio", "reqwest"]
default = ["gnark"]

[dependencies]

# light local deps
light-merkle-tree-reference = { path = "../../merkle-tree/reference" }
light-hasher = { path = "../../merkle-tree/hasher" }
light-indexed-merkle-tree = { path = "../../merkle-tree/indexed" }
light-utils = { path = "../../utils" }
light-merkle-tree-reference = { path = "../../merkle-tree/reference", version = "0.1.0" }
light-hasher = { path = "../../merkle-tree/hasher", version = "0.1.0" }
light-indexed-merkle-tree = { path = "../../merkle-tree/indexed", version = "0.1.0" }
light-utils = { path = "../../utils", version = "0.1.0" }
# ark dependencies
ark-serialize = "0.4.2"
ark-ec = "0.4.2"
Expand Down
6 changes: 5 additions & 1 deletion circuit-lib/verifier/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[package]
name = "light-verifier"
version = "0.1.0"
description = "ZKP proof verifier used in Light Protocol"
repository = "https://github.com/Lightprotocol/light-protocol"
license = "Apache-2.0"
edition = "2021"

[features]
solana = ["solana-program"]

Expand All @@ -14,4 +18,4 @@ solana-program = { version = "1.18.11", optional = true }
[dev-dependencies]
tokio = { version = "1.36.0", features = ["rt", "macros"] }
reqwest = { version = "0.11.24", features = ["json", "rustls-tls"] }
light-circuitlib-rs = { path = "../circuitlib-rs" }
light-circuitlib-rs = { path = "../circuitlib-rs", version = "0.1.0" }
Loading