Repository navigation
79 lines (63 loc) · 1.74 KB
/
Copy pathci.yml
File metadata and controls
79 lines (63 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: ci
on:
push:
branches: [main]
tags: ["v*"]
pull_request:
branches: [main]
workflow_dispatch: {} # 允许在 Actions 页手动触发(Run workflow)/ gh workflow run
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
# --ignore-scripts 跳过 prepare 的自动构建,下面显式构建以便分步可见
- name: Install
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Typecheck
run: pnpm typecheck
- name: Build
run: pnpm build
- name: Pack tarball
run: npm pack
- name: Upload dist + tarball
uses: actions/upload-artifact@v4
with:
name: topic-sdk-${{ github.sha }}
path: |
dist
*.tgz
if-no-files-found: error
release:
# 仅在打 v* tag 时创建 Release(供"从源码/tarball 安装"的消费方下载,不发 npm)
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install
run: pnpm install --frozen-lockfile --ignore-scripts
- name: Build
run: pnpm build
- name: Pack tarball
run: npm pack
- name: Create GitHub Release with tarball
uses: softprops/action-gh-release@v2
with:
files: "*.tgz"