yuangs 1.3.5 → 1.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,27 +1,52 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: Auto Bump & Publish
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
|
-
- main
|
|
6
|
+
- main # 监听 main 分支的提交
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
9
|
publish:
|
|
10
10
|
runs-on: ubuntu-latest
|
|
11
|
+
# 关键权限:允许 Action 修改你的仓库代码(为了回写版本号)
|
|
12
|
+
permissions:
|
|
13
|
+
contents: write
|
|
14
|
+
id-token: write
|
|
15
|
+
|
|
11
16
|
steps:
|
|
12
17
|
- name: Checkout repository
|
|
13
18
|
uses: actions/checkout@v3
|
|
19
|
+
with:
|
|
20
|
+
token: ${{ secrets.GITHUB_TOKEN }} # 使用 GitHub 默认令牌
|
|
14
21
|
|
|
15
22
|
- name: Set up Node.js
|
|
16
23
|
uses: actions/setup-node@v3
|
|
17
24
|
with:
|
|
18
|
-
node-version: '18'
|
|
25
|
+
node-version: '18'
|
|
19
26
|
registry-url: 'https://registry.npmjs.org/'
|
|
20
27
|
|
|
28
|
+
# 1. 配置 Git 身份(机器人身份)
|
|
29
|
+
- name: Configure Git
|
|
30
|
+
run: |
|
|
31
|
+
git config user.name "GitHub Action"
|
|
32
|
+
git config user.email "action@github.com"
|
|
33
|
+
|
|
34
|
+
# 2. 自动增加版本号 (Patch 级别:1.0.0 -> 1.0.1)
|
|
35
|
+
# [skip ci] 是为了防止无限循环触发
|
|
36
|
+
- name: Bump version
|
|
37
|
+
run: |
|
|
38
|
+
npm version patch -m "chore(release): bump version to %s [skip ci]"
|
|
39
|
+
|
|
40
|
+
# 3. 把新的版本号推送到 GitHub 仓库
|
|
41
|
+
- name: Push changes
|
|
42
|
+
run: git push
|
|
43
|
+
|
|
44
|
+
# 4. 安装依赖
|
|
21
45
|
- name: Install dependencies
|
|
22
46
|
run: npm ci
|
|
23
47
|
|
|
48
|
+
# 5. 发布到 npm
|
|
24
49
|
- name: Publish to npm
|
|
25
|
-
run: npm publish
|
|
50
|
+
run: npm publish --provenance
|
|
26
51
|
env:
|
|
27
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
52
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|