Skip to content

Commit 37ac40f

Browse files
committed
fix release workflow: npm paths, crates.io skip, add tests
1 parent 74b45ae commit 37ac40f

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

.github/workflows/release.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ env:
1414
CARGO_TERM_COLOR: always
1515

1616
jobs:
17+
test:
18+
uses: ./.github/workflows/test.yml
19+
1720
build:
21+
needs: test
1822
strategy:
1923
fail-fast: false
2024
matrix:
@@ -202,15 +206,15 @@ jobs:
202206
run: |
203207
for platform in darwin-arm64 darwin-x64 linux-arm64 linux-x64 linux-arm64-musl linux-x64-musl win32-arm64 win32-x64; do
204208
echo "Publishing @jj-ryu/$platform..."
205-
npm publish npm/$platform --access public --provenance
209+
npm publish ./npm/$platform --access public --provenance
206210
done
207211
208212
- name: Publish main package
209213
env:
210214
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
211215
run: |
212216
echo "Publishing jj-ryu..."
213-
npm publish npm/jj-ryu --access public --provenance
217+
npm publish ./npm/jj-ryu --access public --provenance
214218
215219
# Publish to crates.io
216220
publish-crates:
@@ -224,4 +228,11 @@ jobs:
224228
uses: dtolnay/rust-toolchain@stable
225229

226230
- name: Publish to crates.io
227-
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
231+
run: |
232+
cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} || {
233+
if cargo search jj-ryu --limit 1 | grep -q "^jj-ryu = \"${GITHUB_REF#refs/tags/v}\""; then
234+
echo "Version already published, skipping"
235+
else
236+
exit 1
237+
fi
238+
}

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches: [main]
66
pull_request:
7+
workflow_call:
78

89
env:
910
CARGO_INCREMENTAL: 0

0 commit comments

Comments
 (0)