Skip to content

Commit 887577d

Browse files
authored
ci: release workflow (#1834)
1 parent 7f2fcb3 commit 887577d

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
npm:
9+
name: NPM
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v4
16+
with:
17+
node-version: 22
18+
registry-url: "https://registry.npmjs.org"
19+
- name: Install dependencies
20+
run: npm ci
21+
- name: Determine NPM tag
22+
id: npm-tag
23+
run: |
24+
version="${{ github.ref_name }}"
25+
major_version=$(echo "$version" | cut -d. -f1)
26+
27+
if [ "$major_version" = "13" ]; then
28+
echo "tag=legacy" >> $GITHUB_ENV
29+
else
30+
echo "tag=latest" >> $GITHUB_ENV
31+
fi
32+
- name: Publish to NPM
33+
run: npm publish --tag ${{ env.tag }}
34+
env:
35+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)