diff --git a/.github/workflows/publish-rust.yml b/.github/workflows/publish-rust.yml index 51298b8..750c70a 100644 --- a/.github/workflows/publish-rust.yml +++ b/.github/workflows/publish-rust.yml @@ -94,10 +94,23 @@ jobs: - name: Get current version id: version run: | - VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version') + VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "subscriptions") | .version') + if [ -z "$VERSION" ]; then + echo "::error::Could not find subscriptions crate version" + exit 1 + fi echo "version=$VERSION" >> $GITHUB_OUTPUT echo "Publishing subscriptions v$VERSION" + - name: Check crates.io version availability + if: ${{ inputs.publish-to-crates }} + run: | + REGISTRY_CHECK_DIR="${RUNNER_TEMP:-/tmp}" + if (cd "$REGISTRY_CHECK_DIR" && cargo info "subscriptions@${{ steps.version.outputs.version }}" >/dev/null 2>&1); then + echo "::error::subscriptions v${{ steps.version.outputs.version }} already exists on crates.io. Bump clients/rust/Cargo.toml before publishing." + exit 1 + fi + - name: Check if prerelease id: prerelease run: | diff --git a/Cargo.lock b/Cargo.lock index e82286b..83ba403 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5287,7 +5287,7 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subscriptions" -version = "0.1.0" +version = "0.1.1" dependencies = [ "borsh 1.6.0", "num-derive", diff --git a/clients/rust/Cargo.toml b/clients/rust/Cargo.toml index 801ecf8..48b6f43 100644 --- a/clients/rust/Cargo.toml +++ b/clients/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subscriptions" -version = "0.1.0" +version = "0.1.1" edition = "2021" description = "Rust client for the Subscriptions Solana program" license = { workspace = true }