Skip to content

Commit 2f8f6c4

Browse files
committed
fix: use pnpm pack to resolve catalog deps before npm publish
1 parent 774141d commit 2f8f6c4

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

.github/workflows/release.yml

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,31 @@ name: release
33
permissions:
44
id-token: write
55
contents: write
6+
actions: read
67

78
on:
89
push:
910
tags:
1011
- 'v*'
1112

1213
jobs:
14+
ci:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: pnpm/action-setup@v4
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: 24
22+
cache: pnpm
23+
24+
- run: pnpm install
25+
- run: pnpm lint
26+
- run: pnpm prepack
27+
- run: pnpm test
28+
1329
release:
30+
needs: ci
1431
runs-on: ubuntu-latest
1532
steps:
1633
- uses: actions/checkout@v4
@@ -24,13 +41,28 @@ jobs:
2441
registry-url: 'https://registry.npmjs.org'
2542

2643
- run: pnpm install
27-
- run: pnpm dev:prepare
2844
- run: pnpm prepack
2945

46+
- name: Determine npm tag
47+
id: npm-tag
48+
run: |
49+
TAG="${GITHUB_REF#refs/tags/v}"
50+
if [[ "$TAG" == *"-alpha"* ]]; then
51+
echo "tag=alpha" >> $GITHUB_OUTPUT
52+
elif [[ "$TAG" == *"-beta"* ]]; then
53+
echo "tag=beta" >> $GITHUB_OUTPUT
54+
elif [[ "$TAG" == *"-rc"* ]]; then
55+
echo "tag=rc" >> $GITHUB_OUTPUT
56+
else
57+
echo "tag=latest" >> $GITHUB_OUTPUT
58+
fi
59+
3060
- name: GitHub Release
3161
run: pnpm dlx changelogithub
3262
env:
33-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3464

3565
- name: Publish to npm
36-
run: npm publish --provenance --access public
66+
run: |
67+
TARBALL=$(pnpm pack)
68+
npm publish "$TARBALL" --provenance --access public --tag ${{ steps.npm-tag.outputs.tag }}

0 commit comments

Comments
 (0)