Skip to content

Commit d7f404d

Browse files
committed
make publish-rust gh job work for program
1 parent 8143a09 commit d7f404d

File tree

1 file changed

+43
-16
lines changed

1 file changed

+43
-16
lines changed

.github/workflows/publish-rust-client.yml renamed to .github/workflows/publish-rust.yml

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
name: Publish Rust Client
1+
name: Publish Rust
22

33
on:
44
workflow_dispatch:
55
inputs:
6+
lib_type:
7+
description: Library Type
8+
required: true
9+
type: choice
10+
options:
11+
- client
12+
- program
613
level:
714
description: Level
815
required: true
@@ -34,7 +41,7 @@ on:
3441

3542
jobs:
3643
test_rust:
37-
name: Test Rust client
44+
name: Test Rust
3845
runs-on: ubuntu-latest
3946
steps:
4047
- name: Git Checkout
@@ -43,25 +50,41 @@ jobs:
4350
- name: Setup Environment
4451
uses: ./.github/actions/setup
4552
with:
46-
cargo-cache-key: cargo-rust-client
53+
cargo-cache-key: ${{ inputs.lib_type == 'client' && 'cargo-rust-client' || 'cargo-programs' }}
4754
clippy: true
4855
rustfmt: true
4956
solana: true
5057

51-
- name: Format Rust Client
52-
run: pnpm clients:rust:format
58+
- name: Format
59+
run: |
60+
if [ "${{ inputs.lib_type }}" == "client" ]; then
61+
pnpm clients:rust:format
62+
else
63+
pnpm programs:format
64+
fi
5365
54-
- name: Lint Rust Client
55-
run: pnpm clients:rust:lint
66+
- name: Lint
67+
run: |
68+
if [ "${{ inputs.lib_type }}" == "client" ]; then
69+
pnpm clients:rust:lint
70+
else
71+
pnpm programs:lint
72+
fi
5673
57-
- name: Build Programs
74+
- name: Build Program
75+
if: ${{ inputs.lib_type == 'client' }}
5876
run: pnpm programs:build
5977

60-
- name: Test Rust Client
61-
run: pnpm clients:rust:test
78+
- name: Test
79+
run: |
80+
if [ "${{ inputs.lib_type }}" == "client" ]; then
81+
pnpm clients:rust:test
82+
else
83+
pnpm programs:test
84+
fi
6285
6386
publish_rust:
64-
name: Publish Rust Client
87+
name: Publish Rust
6588
runs-on: ubuntu-latest
6689
needs: test_rust
6790
permissions:
@@ -73,8 +96,8 @@ jobs:
7396
- name: Setup Environment
7497
uses: ./.github/actions/setup
7598
with:
76-
cargo-cache-key: cargo-publish-rust-client
77-
cargo-cache-fallback-key: cargo-rust-client
99+
cargo-cache-key: ${{ inputs.lib_type == 'client' && 'cargo-publish-rust-client' || 'cargo-publish-program' }}
100+
cargo-cache-fallback-key: ${{ inputs.lib_type == 'client' && 'cargo-rust-client' || 'cargo-programs' }}
78101
clippy: true
79102
rustfmt: true
80103

@@ -95,7 +118,7 @@ jobs:
95118
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
96119
git config --global user.name "github-actions[bot]"
97120
98-
- name: Publish Rust Client
121+
- name: Publish Rust
99122
id: publish
100123
env:
101124
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
@@ -112,7 +135,11 @@ jobs:
112135
OPTIONS=""
113136
fi
114137
115-
pnpm clients:rust:publish $LEVEL $OPTIONS
138+
if [ "${{ inputs.lib_type }}" == "client" ]; then
139+
pnpm clients:rust:publish $LEVEL $OPTIONS
140+
else
141+
pnpm programs:publish $LEVEL $OPTIONS
142+
fi
116143
117144
- name: Push Commit and Tag
118145
if: github.event.inputs.dry_run != 'true'
@@ -122,4 +149,4 @@ jobs:
122149
if: github.event.inputs.create_release == 'true' && github.event.inputs.dry_run != 'true'
123150
uses: ncipollo/release-action@v1
124151
with:
125-
tag: rust@v${{ steps.publish.outputs.new_version }}
152+
tag: ${{ inputs.lib_type == 'client' && 'rust' || 'program' }}@v${{ steps.publish.outputs.new_version }}

0 commit comments

Comments
 (0)