Skip to content

Commit

Permalink
add local release script rust all (#747)
Browse files Browse the repository at this point in the history
Co-authored-by: Swen <[email protected]>
  • Loading branch information
SwenSchaeferjohann and Swen authored May 15, 2024
1 parent 6e4bb8f commit 332e59e
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions scripts/release-all-rust-crates.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# Configuration
CRATES_IO_TOKEN=${CRATES_IO_TOKEN}

# Ensure cargo, git, and gh are installed
command -v cargo >/dev/null 2>&1 || { echo >&2 "Cargo is not installed. Aborting."; exit 1; }
command -v git >/dev/null 2>&1 || { echo >&2 "Git is not installed. Aborting."; exit 1; }
command -v gh >/dev/null 2>&1 || { echo >&2 "GitHub CLI is not installed. Aborting."; exit 1; }
echo "Tagging and releasing all Rust projects..."

echo "Logging in to crates.io..."
cargo login "${CRATES_IO_TOKEN}"
# TODO: allow dynamic releases, and add gh release workflow
PACKAGES=(""aligned-sized" "light-heap" "light-utils" light-bounded-vec" "light-hasher" "light-macros" "light-hash-set" "light-merkle-tree-reference" "light-concurrent-merkle-tree" "light-indexed-merkle-tree" "light-circuitlib-rs" "light-verifier" "account-compression" "light-registry" "light-system-program" "light-compressed-token" "light-test-utils")
for PACKAGE in "${PACKAGES[@]}"; do
PKG_VERSION=$(cargo pkgid -p "$PACKAGE" | cut -d "#" -f2)
VERSION=${PKG_VERSION#*@}
echo "Creating tag for Rust package: $PACKAGE v$VERSION"
git tag "${PACKAGE}-v${VERSION}"
git push origin "${PACKAGE}-v${VERSION}"
for attempt in {1..3}; do
echo "Attempt $attempt: Publishing $PACKAGE..."
cargo release publish --package "$PACKAGE" --execute --no-confirm && break || echo "Attempt $attempt failed, retrying in 60..."
sleep 60
done
echo "Sleeping for 60 seconds to handle rate limits..."
sleep 60
done

0 comments on commit 332e59e

Please sign in to comment.