Skip to content
Closed
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
32 changes: 21 additions & 11 deletions .github/workflows/release-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ jobs:
git fetch origin ${{ github.event.pull_request.base.sha }}
git fetch origin ${{ github.event.pull_request.head.sha }}

- name: Determine release type
id: release-type
run: |
PR_TITLE="${{ github.event.pull_request.title }}"
if [[ "$PR_TITLE" == *"program-libs"* ]]; then
echo "type=program-libs" >> $GITHUB_OUTPUT
elif [[ "$PR_TITLE" == *"sdk-libs"* ]]; then
echo "type=sdk-libs" >> $GITHUB_OUTPUT
else
echo "Error: Could not determine release type from PR title: $PR_TITLE"
echo "PR title must contain 'program-libs' or 'sdk-libs'"
exit 1
fi
echo "Detected release type: $(cat $GITHUB_OUTPUT)"

- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
Expand All @@ -40,37 +55,40 @@ jobs:
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
RELEASE_TYPE: ${{ steps.release-type.outputs.type }}
run: |
echo "========================================="
echo "Phase 1: Validation (dry-run)"
echo "========================================="
./scripts/release/validate-packages.sh "$BASE_SHA" "$HEAD_SHA"
./scripts/release/validate-packages.sh "$RELEASE_TYPE" "$BASE_SHA" "$HEAD_SHA"

- name: Publish packages to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
RELEASE_TYPE: ${{ steps.release-type.outputs.type }}
run: |
echo ""
echo "========================================="
echo "Phase 2: Publishing (atomic)"
echo "========================================="
./scripts/release/validate-packages.sh --execute "$BASE_SHA" "$HEAD_SHA"
./scripts/release/validate-packages.sh --execute "$RELEASE_TYPE" "$BASE_SHA" "$HEAD_SHA"

- name: Create GitHub releases
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
RELEASE_TYPE: ${{ steps.release-type.outputs.type }}
run: |
echo ""
echo "========================================="
echo "Phase 3: Creating GitHub releases"
echo "========================================="

# Detect packages that were published
PACKAGES_STRING=$(./scripts/release/detect-version-changes.sh "$BASE_SHA" "$HEAD_SHA")
PACKAGES_STRING=$(./scripts/release/detect-version-changes.sh "$RELEASE_TYPE" "$BASE_SHA" "$HEAD_SHA")
read -ra PACKAGES <<< "$PACKAGES_STRING"

for pkg in "${PACKAGES[@]}"; do
Expand Down Expand Up @@ -105,11 +123,3 @@ jobs:

echo ""
echo "✓ GitHub releases created"

- name: Trigger docs sync
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.DOCS_REPO_TOKEN }}
repository: Lightprotocol/docs
event-type: sync-handlers
client-payload: '{"commit": "${{ github.sha }}", "release": true}'
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
cargo test -p light-hash-set --all-features
cargo test -p batched-merkle-tree-test -- --skip test_simulate_transactions --skip test_e2e
cargo test -p light-concurrent-merkle-tree
cargo test -p light-token-interface --features poseidon
cargo test -p light-token-interface --features poseidon,test-only
cargo test -p light-compressible --all-features
- name: program-libs-slow
packages: light-bloom-filter light-indexed-merkle-tree batched-merkle-tree-test
Expand Down
24 changes: 11 additions & 13 deletions Cargo.lock

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

28 changes: 15 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -178,45 +178,47 @@ light-hash-set = { version = "4.0.0", path = "program-libs/hash-set" }
light-indexed-merkle-tree = { version = "5.0.0", path = "program-libs/indexed-merkle-tree" }
light-concurrent-merkle-tree = { version = "5.0.0", path = "program-libs/concurrent-merkle-tree" }
light-sparse-merkle-tree = { version = "0.3.0", path = "sparse-merkle-tree" }
light-client = { path = "sdk-libs/client", version = "0.17.2" }
light-event = { path = "sdk-libs/event", version = "0.2.1" }
light-client = { path = "sdk-libs/client", version = "0.18.0" }
light-event = { path = "sdk-libs/event", version = "0.3.0" }
light-hasher = { path = "program-libs/hasher", version = "5.0.0", default-features = false }
light-macros = { path = "program-libs/macros", version = "2.2.0" }
light-merkle-tree-reference = { path = "program-tests/merkle-tree", version = "4.0.0" }
light-heap = { path = "program-libs/heap", version = "2.0.0" }
light-prover-client = { path = "prover/client", version = "5.0.1" }
light-sdk = { path = "sdk-libs/sdk", version = "0.17.1" }
light-sdk-pinocchio = { path = "sdk-libs/sdk-pinocchio", version = "0.17.1" }
light-sdk-macros = { path = "sdk-libs/macros", version = "0.17.1" }
light-sdk-types = { path = "sdk-libs/sdk-types", version = "0.17.1", default-features = false }
light-sdk = { path = "sdk-libs/sdk", version = "0.18.0" }
light-sdk-pinocchio = { path = "sdk-libs/sdk-pinocchio", version = "0.18.0" }
light-sdk-macros = { path = "sdk-libs/macros", version = "0.18.0" }
light-sdk-types = { path = "sdk-libs/sdk-types", version = "0.18.0", default-features = false }
light-compressed-account = { path = "program-libs/compressed-account", version = "0.8.0", default-features = false }
light-compressible = { path = "program-libs/compressible", version = "0.3.0", default-features = false }
light-token-interface = { path = "program-libs/token-interface", version = "0.1.1" }
light-token-interface = { path = "program-libs/token-interface", version = "0.2.0" }
light-account-checks = { path = "program-libs/account-checks", version = "0.6.0", default-features = false }
light-verifier = { path = "program-libs/verifier", version = "7.0.0" }
light-zero-copy = { path = "program-libs/zero-copy", version = "0.6.0", default-features = false }
light-zero-copy-derive = { path = "program-libs/zero-copy-derive", version = "0.6.0" }
photon-api = { path = "sdk-libs/photon-api", version = "0.53.0" }
photon-api = { path = "sdk-libs/photon-api", version = "0.54.0" }
forester-utils = { path = "forester-utils", version = "2.0.0" }
account-compression = { path = "programs/account-compression", version = "2.0.0", features = [
"cpi",
] }
light-compressed-token = { path = "programs/compressed-token/program", version = "2.1.0", features = [
# Note: v2.1.0 exists as GitHub release but not on crates.io
light-compressed-token = { path = "programs/compressed-token/program", version = "2.0.0", features = [
"cpi",
] }
light-token-types = { path = "sdk-libs/token-types", version = "0.2.1" }
light-token = { path = "sdk-libs/token-sdk", version = "0.2.1" }
light-token-types = { path = "sdk-libs/token-types", version = "0.3.0" }
light-token = { path = "sdk-libs/token-sdk", version = "0.3.0" }
light-token-client = { path = "sdk-libs/token-client", version = "0.1.0" }
light-system-program-anchor = { path = "anchor-programs/system", version = "2.0.0", features = [
"cpi",
] }
light-registry = { path = "programs/registry", version = "2.1.0", features = [
# Note: v2.1.0 exists as GitHub release but not on crates.io
light-registry = { path = "programs/registry", version = "2.0.0", features = [
"cpi",
] }
create-address-test-program = { path = "program-tests/create-address-test-program", version = "1.0.0", features = [
"cpi",
] }
light-program-test = { path = "sdk-libs/program-test", version = "0.17.1" }
light-program-test = { path = "sdk-libs/program-test", version = "0.18.0" }
light-batched-merkle-tree = { path = "program-libs/batched-merkle-tree", version = "0.8.0" }
light-merkle-tree-metadata = { path = "program-libs/merkle-tree-metadata", version = "0.8.0" }
aligned-sized = { path = "program-libs/aligned-sized", version = "1.1.0" }
Expand Down
3 changes: 1 addition & 2 deletions program-libs/token-interface/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "light-token-interface"
version = "0.1.1"
version = "0.2.0"
edition = { workspace = true }
description = "Light Protocol token instruction data types."
license = "MIT"
Expand Down Expand Up @@ -52,7 +52,6 @@ light-account-checks = { workspace = true, features = [
"solana",
] }
spl-token-metadata-interface = "0.6.0"
light-token-interface = { workspace = true, features = ["poseidon", "test-only"] }
light-hasher = { workspace = true, features = ["keccak", "sha256", "poseidon"] }

[lints.rust.unexpected_cfgs]
Expand Down
28 changes: 22 additions & 6 deletions scripts/release/create-release-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,24 @@ fi
# Function to get version changes between two git refs
# Output format: One line per package: "package-name old-version new-version"
get_version_changes() {
local base_ref="$1"
local head_ref="$2"
local release_type="$1"
local base_ref="$2"
local head_ref="$3"

# Set the grep pattern based on release type
local grep_pattern
case "$release_type" in
program-libs)
grep_pattern='program-libs/'
;;
sdk-libs)
grep_pattern='(sdk-libs|program-tests/merkle-tree|sparse-merkle-tree|prover)/'
;;
*)
echo "Error: Release type must be 'program-libs' or 'sdk-libs'" >&2
return 1
;;
esac

# Fetch if comparing against remote refs
if [[ "$base_ref" == origin/* ]]; then
Expand All @@ -44,7 +60,7 @@ get_version_changes() {
diff_args=("$base_ref...$head_ref")
fi

# Get list of changed Cargo.toml files in program-libs, sdk-libs, program-tests/merkle-tree, sparse-merkle-tree, and prover
# Get list of changed Cargo.toml files in the specified directory
while IFS= read -r file; do
# Extract old and new version from the diff
local versions=$(git diff "${diff_args[@]}" -- "$file" | grep -E '^\+version|^-version' | grep -v '+++\|---')
Expand All @@ -60,7 +76,7 @@ get_version_changes() {
echo "$pkg_name $old_ver $new_ver"
fi
fi
done < <(git diff "${diff_args[@]}" --name-only -- '**/Cargo.toml' | grep -E '(program-libs|sdk-libs|program-tests/merkle-tree|sparse-merkle-tree|prover)/')
done < <(git diff "${diff_args[@]}" --name-only -- '**/Cargo.toml' | grep -E "$grep_pattern")
}

# Check if there are changes
Expand All @@ -85,7 +101,7 @@ echo "Comparing against: $TARGET_BRANCH"
echo ""

# Get version changes using the function
VERSION_CHANGES_RAW=$(get_version_changes "$TARGET_BRANCH" "HEAD")
VERSION_CHANGES_RAW=$(get_version_changes "$RELEASE_TYPE" "$TARGET_BRANCH" "HEAD")

# Build packages array and formatted version changes
PACKAGES=()
Expand All @@ -111,7 +127,7 @@ echo ""

# Validate packages using the validation script (comparing against target branch)
# Note: Changes are in working directory but not yet committed
if "$SCRIPT_DIR/validate-packages.sh" "$TARGET_BRANCH" "HEAD"; then
if "$SCRIPT_DIR/validate-packages.sh" "$RELEASE_TYPE" "$TARGET_BRANCH" "HEAD"; then
echo ""
echo "All crates validated successfully"
else
Expand Down
Loading
Loading