Skip to content

Commit cfe1552

Browse files
ci: 统一 typecheck 命令并添加 npm 发布工作流
1 parent 9624f88 commit cfe1552

2 files changed

Lines changed: 54 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
run: bun install --frozen-lockfile
2222

2323
- name: Type check
24-
run: bunx tsc --noEmit
24+
run: bun run typecheck
2525

2626
- name: Test with Coverage
2727
run: |

.github/workflows/publish-npm.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: read
10+
packages: write
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: '20.x'
21+
registry-url: 'https://registry.npmjs.org'
22+
23+
- name: Setup Bun
24+
uses: oven-sh/setup-bun@v2
25+
with:
26+
bun-version: latest
27+
28+
- name: Install dependencies
29+
run: bun install --frozen-lockfile
30+
31+
- name: Build
32+
run: bun run build:vite
33+
34+
- name: Type check
35+
run: bun run typecheck
36+
37+
- name: Run tests
38+
run: bun test
39+
40+
- name: Publish to npm
41+
run: |
42+
VERSION="${GITHUB_REF_NAME#v}"
43+
TAG="latest"
44+
if [[ "$VERSION" == *"beta"* ]]; then
45+
TAG="beta"
46+
elif [[ "$VERSION" == *"alpha"* ]]; then
47+
TAG="alpha"
48+
elif [[ "$VERSION" == *"rc"* ]]; then
49+
TAG="rc"
50+
fi
51+
npm publish --tag "$TAG" --access public
52+
env:
53+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)