forked from alibaba/bifrostui
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (38 loc) · 1.15 KB
/
npm-publish.yml
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
# 发布到npm
# 开发者请在本地执行lerna version进行版本控制,提交后触发自动发布
name: Publish to npm
on:
workflow_run:
workflows: ['Unit Tests', 'Code Check']
types:
- completed
branches:
- main
if: startsWith(github.ref, 'refs/tags/v')
jobs:
build-and-publish:
# ['Unit Tests', 'Code Check']工作流成功完成
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 确保检出带有版本标签的提交
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org/'
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: '9'
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Publish to NPM
run: npx lerna publish --yes from-git
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # 在 GitHub Secrets 中设置的 NPM_TOKEN