Skip to content

Commit 7450cc4

Browse files
authored
CI: Run semver checks on publish (solana-program#10)
* CI: Move semver check to publish step #### Problem Similar to solana-program/libraries#57 but for the token-metadata repo. #### Summary of changes Move semver checks to happen during publish. * Remove the script * Use the pinocchio way * Make publish depend on semver * Add more version options, fix inputs.crate * Remove space
1 parent 1a42ba5 commit 7450cc4

File tree

2 files changed

+36
-25
lines changed

2 files changed

+36
-25
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -86,27 +86,6 @@ jobs:
8686
- name: Run cargo-audit
8787
run: pnpm rust:audit
8888

89-
semver_rust:
90-
name: Check semver Rust
91-
runs-on: ubuntu-latest
92-
steps:
93-
- name: Git Checkout
94-
uses: actions/checkout@v4
95-
96-
- name: Setup Environment
97-
uses: ./.github/actions/setup
98-
with:
99-
cli: true
100-
cargo-cache-key: cargo-semver
101-
102-
- name: Install cargo-semver-checks
103-
uses: taiki-e/install-action@v2
104-
with:
105-
tool: cargo-semver-checks
106-
107-
- name: Run semver checks
108-
run: pnpm rust:semver
109-
11089
spellcheck_rust:
11190
name: Spellcheck Rust
11291
runs-on: ubuntu-latest

.github/workflows/publish-rust.yml

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,46 @@ jobs:
6565
- name: Lint
6666
run: pnpm zx ./scripts/rust/lint.mjs "${{ inputs.package_path }}"
6767

68-
- name: Build Program
68+
- name: Build programs
6969
run: pnpm programs:build
7070

7171
- name: Test
7272
run: pnpm zx ./scripts/rust/test.mjs "${{ inputs.package_path }}"
7373

74+
semver:
75+
name: Check Semver
76+
runs-on: ubuntu-latest
77+
steps:
78+
- name: Git checkout
79+
uses: actions/checkout@v4
80+
81+
- name: Setup Environment
82+
uses: ./.github/actions/setup
83+
with:
84+
cargo-cache-key: cargo-publish-semver-${{ inputs.package_path }}
85+
cargo-cache-fallback-key: cargo-publish-semver
86+
87+
- name: Install cargo-semver-checks
88+
uses: taiki-e/install-action@v2
89+
with:
90+
tool: cargo-semver-checks,cargo-release
91+
92+
- name: Set Version
93+
run: |
94+
if [ "${{ inputs.level }}" == "version" ]; then
95+
LEVEL=${{ inputs.version }}
96+
else
97+
LEVEL=${{ inputs.level }}
98+
fi
99+
cargo release $LEVEL --manifest-path "${{ inputs.package_path }}/Cargo.toml" --no-tag --no-publish --no-push --no-confirm --execute
100+
101+
- name: Check semver
102+
run: pnpm rust:semver --manifest-path "${{ inputs.package_path }}/Cargo.toml"
103+
74104
publish:
75105
name: Publish Rust Crate
76106
runs-on: ubuntu-latest
77-
needs: test
107+
needs: [test, semver]
78108
permissions:
79109
contents: write
80110
steps:
@@ -91,8 +121,10 @@ jobs:
91121
cargo-cache-key: cargo-publish-${{ inputs.package_path }}
92122
cargo-cache-fallback-key: cargo-publish
93123

94-
- name: Install Cargo Release
95-
run: which cargo-release || cargo install cargo-release
124+
- name: Install cargo-release
125+
uses: taiki-e/install-action@v2
126+
with:
127+
tool: cargo-release
96128

97129
- name: Ensure CARGO_REGISTRY_TOKEN variable is set
98130
env:

0 commit comments

Comments
 (0)