-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add local release script rust all (#747)
Co-authored-by: Swen <[email protected]>
- Loading branch information
1 parent
6e4bb8f
commit 332e59e
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |