Skip to content

chore: remove automatic subgraph runbook generation #858

chore: remove automatic subgraph runbook generation

chore: remove automatic subgraph runbook generation #858

name: Publish Rust Crates
on:
push:
branches:
- main
workflow_dispatch:
inputs:
crates:
description: 'Space-separated list of crates to publish (leave empty to publish all)'
required: false
default: ''
dry_run:
description: 'Dry run (do not actually publish)'
required: false
type: boolean
default: false
jobs:
publish:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo registry and index
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-publish-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: cargo-publish-${{ runner.os }}-
- name: Authenticate with crates.io (Trusted Publishing)
uses: rust-lang/crates-io-auth-action@v1
id: auth
- name: Publish crates
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
DRY_RUN: ${{ inputs.dry_run }}
run: |
if [ -n "${{ inputs.crates }}" ]; then
CRATES="${{ inputs.crates }}"
else
CRATES="surfpool-types surfpool-db surfpool-core surfpool-studio-ui"
fi
for CRATE in $CRATES; do
VERSION=$(cargo metadata --format-version=1 --no-deps \
| jq -r --arg name "$CRATE" '.packages[] | select(.name == $name) | .version')
if [ -z "$VERSION" ]; then
echo "::warning::Could not find version for $CRATE, skipping"
continue
fi
# Check crates.io API to see if crate is already published
API_RESPONSE=$(curl -s \
-H "User-Agent: surfpool-release-workflow (github.com/solana-foundation/surfpool)" \
"https://crates.io/api/v1/crates/$CRATE/$VERSION")
if echo "$API_RESPONSE" | jq -e '.version' > /dev/null 2>&1; then
echo "$CRATE@$VERSION is already published, skipping"
continue
fi
echo "Publishing $CRATE@$VERSION..."
if [ "$DRY_RUN" = "true" ]; then
cargo publish --package "$CRATE" --dry-run
else
cargo publish --package "$CRATE"
sleep 15
fi
done