-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (59 loc) · 1.64 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Publish npm
# 触发工作流程的事件
on:
push:
branches:
- main
# 按顺序运行作业
jobs:
publish-npm:
# 指定的运行器环境
runs-on: ubuntu-latest
# 权限
permissions:
pull-requests: write
contents: write
issues: write
packages: write
# # 设置 node 版本
strategy:
matrix:
node-version: [20]
# npm-version: [8]
steps:
- name: 拉取 github 仓库代码
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: 设定 node 环境
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# 设置发包 npm 地址仓库
registry-url: https://registry.npmjs.org
# cache: 'npm'
# - name: 设定 npm 版本
# uses: npm/action-setup@v2
# with:
# version: ${{ matrix.npm-version }}
- name: 安装依赖
run: npm install
- name: 构建
run: npm run build
- name: 合并版本,发布
uses: changesets/action@v1
with:
# version: npx changeset version
publish: npx changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
# - name: 发布
# run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}