1- name : Publish Rust Client
1+ name : Publish Rust Crate
22
33on :
44 workflow_dispatch :
55 inputs :
6+ package_path :
7+ description : Path to directory with package to release
8+ required : true
9+ type : string
610 level :
711 description : Level
812 required : true
3438
3539jobs :
3640 test_rust :
37- name : Test Rust client
41+ name : Test Rust Crate
3842 runs-on : ubuntu-latest
3943 steps :
4044 - name : Git Checkout
@@ -43,25 +47,34 @@ jobs:
4347 - name : Setup Environment
4448 uses : ./.github/actions/setup
4549 with :
46- cargo-cache-key : cargo-rust-client
50+ cargo-cache-key : cargo-rust-${{ github.event.inputs.package_path }}
4751 clippy : true
4852 rustfmt : true
4953 solana : true
54+
55+ - name : Convert package_path to required variables
56+ run : |
57+ PACKAGE_PATH="${{ github.event.inputs.package_path }}"
58+ RECIPE_SUFFIX="${PACKAGE_PATH//\//-}"
59+ TAG_PREFIX="$(basename "$PACKAGE_PATH")"
60+
61+ echo "RECIPE_SUFFIX=$RECIPE_SUFFIX" >> $GITHUB_ENV
62+ echo "TAG_PREFIX=$TAG_PREFIX" >> $GITHUB_ENV
5063
5164 - name : Format
52- run : make format-clients-rust
65+ run : make format-${{ env.RECIPE_SUFFIX }}
5366
5467 - name : Lint
55- run : make clippy-clients-rust
68+ run : make clippy-${{ env.RECIPE_SUFFIX }}
5669
57- - name : Build program
58- run : make build-program
70+ - name : Build
71+ run : make build-${{ env.RECIPE_SUFFIX }}
5972
6073 - name : Test
61- run : make test-clients-rust
74+ run : make test-${{ env.RECIPE_SUFFIX }}
6275
6376 publish_rust :
64- name : Publish Rust Client
77+ name : Publish Rust Crate
6578 runs-on : ubuntu-latest
6679 needs : test_rust
6780 permissions :
7386 - name : Setup Environment
7487 uses : ./.github/actions/setup
7588 with :
76- cargo-cache-key : cargo-publish-rust-client
77- cargo-cache-fallback-key : cargo-rust-client
89+ cargo-cache-key : cargo-publish-rust-${{ github.event.inputs.package_path }}
90+ cargo-cache-fallback-key : cargo-rust-${{ github.event.inputs.package_path }}
7891 clippy : true
7992 rustfmt : true
8093
95108 git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
96109 git config --global user.name "github-actions[bot]"
97110
98- - name : Publish Rust Client
111+ - name : Publish Rust Crate
99112 id : publish
100113 env :
101114 CARGO_REGISTRY_TOKEN : ${{ secrets.CARGO_REGISTRY_TOKEN }}
@@ -112,14 +125,10 @@ jobs:
112125 OPTIONS=""
113126 fi
114127
115- ./scripts/publish-rust.sh clients/rust $LEVEL $OPTIONS
116-
117- - name : Push Commit and Tag
118- if : github.event.inputs.dry_run != 'true'
119- run : git push origin --follow-tags
128+ ./scripts/publish-rust.sh ${{ github.event.inputs.package_path }} $LEVEL $OPTIONS
120129
121130 - name : Create GitHub release
122131 if : github.event.inputs.create_release == 'true' && github.event.inputs.dry_run != 'true'
123132 uses : ncipollo/release-action@v1
124133 with :
125- tag : rust @v${{ steps.publish.outputs.new_version }}
134+ tag : ${{ env.TAG_PREFIX }} @v${{ steps.publish.outputs.new_version }}
0 commit comments