Skip to content

Commit 380e6a2

Browse files
committed
fix(ci): combine release and publish into single workflow
Workflows triggered by GITHUB_TOKEN don't trigger other workflows. Merging them ensures npm publish runs after release creation.
1 parent 8d48b87 commit 380e6a2

File tree

2 files changed

+36
-51
lines changed

2 files changed

+36
-51
lines changed

.github/workflows/publish.yml

Lines changed: 0 additions & 50 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ on:
77

88
permissions:
99
contents: write
10+
id-token: write
1011

1112
jobs:
1213
release:
13-
name: Create Release
14+
name: Release & Publish
1415
runs-on: ubuntu-latest
1516
steps:
1617
- name: Checkout
@@ -21,3 +22,37 @@ jobs:
2122
with:
2223
generate_release_notes: true
2324
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
25+
26+
- name: Setup Bun
27+
uses: oven-sh/setup-bun@v2
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v6
31+
with:
32+
node-version: "22"
33+
registry-url: "https://registry.npmjs.org"
34+
35+
- name: Install dependencies
36+
run: bun install --frozen-lockfile
37+
38+
- name: Build
39+
run: bun run build
40+
41+
- name: Determine dist-tag
42+
id: dist-tag
43+
run: |
44+
VERSION="${GITHUB_REF_NAME#v}"
45+
if [[ "$VERSION" == *"alpha"* ]]; then
46+
echo "tag=alpha" >> $GITHUB_OUTPUT
47+
elif [[ "$VERSION" == *"beta"* ]]; then
48+
echo "tag=beta" >> $GITHUB_OUTPUT
49+
elif [[ "$VERSION" == *"rc"* ]]; then
50+
echo "tag=rc" >> $GITHUB_OUTPUT
51+
else
52+
echo "tag=latest" >> $GITHUB_OUTPUT
53+
fi
54+
55+
- name: Publish to npm
56+
run: npm publish --provenance --access public --tag ${{ steps.dist-tag.outputs.tag }}
57+
env:
58+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)