From f9a43d50648f36ca0fcbdc514f546c47be6f9870 Mon Sep 17 00:00:00 2001 From: Jo D Date: Thu, 21 May 2026 11:22:33 -0400 Subject: [PATCH 1/7] ci: use shared cargo publish action --- .github/workflows/publish-rust.yml | 63 +++++++++--------------------- 1 file changed, 19 insertions(+), 44 deletions(-) diff --git a/.github/workflows/publish-rust.yml b/.github/workflows/publish-rust.yml index 47f525c..27aa62d 100644 --- a/.github/workflows/publish-rust.yml +++ b/.github/workflows/publish-rust.yml @@ -85,56 +85,31 @@ jobs: cd program && cargo build cd .. && pnpm run generate-clients - - name: Build check - run: cargo build - - - name: Verify crate package - run: cargo publish --dry-run --locked --allow-dirty - - - name: Get current version - id: version - run: | - 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: Publish Rust client crate + id: cargo_publish + uses: dev-jodee/github-actions/cargo-publish@feat/cargo-publish-action + with: + package: subscriptions + working-directory: clients/rust + allow-dirty: 'true' + check-version-available: ${{ inputs.publish-to-crates }} + dry-run: ${{ !inputs.publish-to-crates }} + skip-existing: 'true' - name: Check if prerelease id: prerelease run: | - if [[ "${{ steps.version.outputs.version }}" == *"-"* ]]; then + if [[ "${{ steps.cargo_publish.outputs.version }}" == *"-"* ]]; then echo "is_prerelease=true" >> $GITHUB_OUTPUT else echo "is_prerelease=false" >> $GITHUB_OUTPUT fi - - name: Authenticate crates.io trusted publisher - if: ${{ inputs.publish-to-crates }} - id: crates_io_auth - uses: rust-lang/crates-io-auth-action@bbd81622f20ce9e2dd9622e3218b975523e45bbe # v1.0.4 - - - name: Publish to crates.io - if: ${{ inputs.publish-to-crates }} - env: - CARGO_REGISTRY_TOKEN: ${{ steps.crates_io_auth.outputs.token }} - run: cargo publish --locked --allow-dirty - - name: Create and push tag + if: ${{ inputs.publish-to-crates || inputs.create-github-release }} working-directory: . run: | - TAG="rust-client-v${{ steps.version.outputs.version }}" + TAG="rust-client-v${{ steps.cargo_publish.outputs.version }}" if git rev-parse "$TAG" >/dev/null 2>&1; then echo "Tag $TAG already exists, skipping" else @@ -149,8 +124,8 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | - const tagName = `rust-client-v${{ steps.version.outputs.version }}`; - const releaseName = `Rust Client v${{ steps.version.outputs.version }}`; + const tagName = `rust-client-v${{ steps.cargo_publish.outputs.version }}`; + const releaseName = `Rust Client v${{ steps.cargo_publish.outputs.version }}`; const isPrerelease = '${{ steps.prerelease.outputs.is_prerelease }}' === 'true'; try { @@ -170,7 +145,7 @@ jobs: repo: context.repo.repo, tag_name: tagName, name: releaseName, - body: `Release of subscriptions v${{ steps.version.outputs.version }}\n\n**crates.io:** https://crates.io/crates/subscriptions/${{ steps.version.outputs.version }}`, + body: `Release of subscriptions v${{ steps.cargo_publish.outputs.version }}\n\n**crates.io:** https://crates.io/crates/subscriptions/${{ steps.cargo_publish.outputs.version }}`, draft: false, prerelease: isPrerelease, }); @@ -179,11 +154,11 @@ jobs: run: | echo "## subscriptions Published" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY - echo "**Version**: \`${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY - echo "**Tag**: \`rust-client-v${{ steps.version.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY + echo "**Version**: \`${{ steps.cargo_publish.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY + echo "**Tag**: \`rust-client-v${{ steps.cargo_publish.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY if [ "${{ inputs.publish-to-crates }}" == "true" ]; then - echo "Published to crates.io: https://crates.io/crates/subscriptions/${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY + echo "Published to crates.io: https://crates.io/crates/subscriptions/${{ steps.cargo_publish.outputs.version }}" >> $GITHUB_STEP_SUMMARY else echo "Skipped crates.io publish" >> $GITHUB_STEP_SUMMARY fi From 49267f90b945ee8eae7b24a6c872cb945c71d579 Mon Sep 17 00:00:00 2001 From: Jo D Date: Thu, 21 May 2026 12:34:44 -0400 Subject: [PATCH 2/7] ci: mark cargo publish smoke version --- Cargo.lock | 2 +- clients/rust/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1b973a8..909a76a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5331,7 +5331,7 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subscriptions" -version = "0.1.2" +version = "0.1.3-do-not-use-action-test.0" dependencies = [ "borsh", "num-derive", diff --git a/clients/rust/Cargo.toml b/clients/rust/Cargo.toml index 3efc915..03928e3 100644 --- a/clients/rust/Cargo.toml +++ b/clients/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subscriptions" -version = "0.1.2" +version = "0.1.3-do-not-use-action-test.0" edition = "2021" description = "Rust client for the Subscriptions Solana program" license = { workspace = true } From daafcbb161baa1b2cdc9ebe87f51b365184a034a Mon Sep 17 00:00:00 2001 From: Jo D Date: Thu, 21 May 2026 13:23:40 -0400 Subject: [PATCH 3/7] ci: add crates auth validation toggle --- .github/workflows/publish-rust.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/publish-rust.yml b/.github/workflows/publish-rust.yml index 27aa62d..5cfc3e8 100644 --- a/.github/workflows/publish-rust.yml +++ b/.github/workflows/publish-rust.yml @@ -13,6 +13,11 @@ on: required: true default: true type: boolean + validate-crates-auth: + description: 'Validate crates.io Trusted Publishing auth without publishing' + required: true + default: false + type: boolean permissions: contents: write @@ -94,6 +99,7 @@ jobs: allow-dirty: 'true' check-version-available: ${{ inputs.publish-to-crates }} dry-run: ${{ !inputs.publish-to-crates }} + validate-auth: ${{ inputs.validate-crates-auth }} skip-existing: 'true' - name: Check if prerelease @@ -162,3 +168,6 @@ jobs: else echo "Skipped crates.io publish" >> $GITHUB_STEP_SUMMARY fi + if [ "${{ steps.cargo_publish.outputs.authenticated }}" == "true" ]; then + echo "Validated crates.io Trusted Publishing auth" >> $GITHUB_STEP_SUMMARY + fi From 8162263b106608b11d5ff7267cc9db21109f3cf7 Mon Sep 17 00:00:00 2001 From: Jo D Date: Thu, 21 May 2026 13:53:43 -0400 Subject: [PATCH 4/7] ci: finalize shared cargo publish workflow --- .github/workflows/publish-rust.yml | 15 ++++----------- Cargo.lock | 2 +- clients/rust/Cargo.toml | 2 +- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish-rust.yml b/.github/workflows/publish-rust.yml index 5cfc3e8..44129be 100644 --- a/.github/workflows/publish-rust.yml +++ b/.github/workflows/publish-rust.yml @@ -13,11 +13,6 @@ on: required: true default: true type: boolean - validate-crates-auth: - description: 'Validate crates.io Trusted Publishing auth without publishing' - required: true - default: false - type: boolean permissions: contents: write @@ -92,14 +87,13 @@ jobs: - name: Publish Rust client crate id: cargo_publish - uses: dev-jodee/github-actions/cargo-publish@feat/cargo-publish-action + uses: solana-developers/github-actions/cargo-publish@main with: package: subscriptions working-directory: clients/rust allow-dirty: 'true' check-version-available: ${{ inputs.publish-to-crates }} dry-run: ${{ !inputs.publish-to-crates }} - validate-auth: ${{ inputs.validate-crates-auth }} skip-existing: 'true' - name: Check if prerelease @@ -163,11 +157,10 @@ jobs: echo "**Version**: \`${{ steps.cargo_publish.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY echo "**Tag**: \`rust-client-v${{ steps.cargo_publish.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY - if [ "${{ inputs.publish-to-crates }}" == "true" ]; then + if [ "${{ steps.cargo_publish.outputs.published }}" == "true" ]; then echo "Published to crates.io: https://crates.io/crates/subscriptions/${{ steps.cargo_publish.outputs.version }}" >> $GITHUB_STEP_SUMMARY + elif [ "${{ steps.cargo_publish.outputs.already-published }}" == "true" ]; then + echo "Skipped crates.io publish; version already exists: https://crates.io/crates/subscriptions/${{ steps.cargo_publish.outputs.version }}" >> $GITHUB_STEP_SUMMARY else echo "Skipped crates.io publish" >> $GITHUB_STEP_SUMMARY fi - if [ "${{ steps.cargo_publish.outputs.authenticated }}" == "true" ]; then - echo "Validated crates.io Trusted Publishing auth" >> $GITHUB_STEP_SUMMARY - fi diff --git a/Cargo.lock b/Cargo.lock index 909a76a..1b973a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5331,7 +5331,7 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subscriptions" -version = "0.1.3-do-not-use-action-test.0" +version = "0.1.2" dependencies = [ "borsh", "num-derive", diff --git a/clients/rust/Cargo.toml b/clients/rust/Cargo.toml index 03928e3..3efc915 100644 --- a/clients/rust/Cargo.toml +++ b/clients/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "subscriptions" -version = "0.1.3-do-not-use-action-test.0" +version = "0.1.2" edition = "2021" description = "Rust client for the Subscriptions Solana program" license = { workspace = true } From 9efc7fa00e0baeb245f348889de4b78f44379cff Mon Sep 17 00:00:00 2001 From: Jo D Date: Fri, 22 May 2026 08:45:55 -0400 Subject: [PATCH 5/7] ci: test shared cargo publish action --- .github/workflows/publish-rust.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-rust.yml b/.github/workflows/publish-rust.yml index 44129be..caffb41 100644 --- a/.github/workflows/publish-rust.yml +++ b/.github/workflows/publish-rust.yml @@ -85,9 +85,12 @@ jobs: cd program && cargo build cd .. && pnpm run generate-clients + - name: Build Rust client crate + run: cargo build + - name: Publish Rust client crate id: cargo_publish - uses: solana-developers/github-actions/cargo-publish@main + uses: dev-jodee/github-actions/cargo-publish@e15ede4 with: package: subscriptions working-directory: clients/rust From 58ff8c92dd03e1413550a1255de441510da3467f Mon Sep 17 00:00:00 2001 From: Jo D Date: Fri, 22 May 2026 08:53:33 -0400 Subject: [PATCH 6/7] ci: use full cargo publish action sha --- .github/workflows/publish-rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-rust.yml b/.github/workflows/publish-rust.yml index caffb41..3091e23 100644 --- a/.github/workflows/publish-rust.yml +++ b/.github/workflows/publish-rust.yml @@ -90,7 +90,7 @@ jobs: - name: Publish Rust client crate id: cargo_publish - uses: dev-jodee/github-actions/cargo-publish@e15ede4 + uses: dev-jodee/github-actions/cargo-publish@e15ede4246abd98badb4701d34394865e382a2de with: package: subscriptions working-directory: clients/rust From 36d46429aeea2b06b452d77998e3d1114441ac39 Mon Sep 17 00:00:00 2001 From: Jo D Date: Fri, 22 May 2026 11:09:31 -0400 Subject: [PATCH 7/7] ci: use upstream cargo publish action --- .github/workflows/publish-rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-rust.yml b/.github/workflows/publish-rust.yml index 3091e23..6281a88 100644 --- a/.github/workflows/publish-rust.yml +++ b/.github/workflows/publish-rust.yml @@ -90,7 +90,7 @@ jobs: - name: Publish Rust client crate id: cargo_publish - uses: dev-jodee/github-actions/cargo-publish@e15ede4246abd98badb4701d34394865e382a2de + uses: solana-developers/github-actions/cargo-publish@e2cd34eb09f996b48be7f6daeb8f455094dd6d53 with: package: subscriptions working-directory: clients/rust