yuangs 1.3.7 → 1.3.8

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.
@@ -3,49 +3,51 @@ name: Auto Bump & Publish
3
3
  on:
4
4
  push:
5
5
  branches:
6
- - main # 监听 main 分支的提交
6
+ - main # 如果你的默认分支不是 main,记得改成对应名字
7
7
 
8
8
  jobs:
9
9
  publish:
10
10
  runs-on: ubuntu-latest
11
- # 关键权限:允许 Action 修改你的仓库代码(为了回写版本号)
11
+
12
+ # 权限:允许 Action 修改仓库代码 + 生成 provenance
12
13
  permissions:
13
14
  contents: write
14
15
  id-token: write
15
16
 
16
17
  steps:
17
18
  - name: Checkout repository
18
- uses: actions/checkout@v3
19
+ uses: actions/checkout@v4
19
20
  with:
20
- token: ${{ secrets.GITHUB_TOKEN }} # 使用 GitHub 默认令牌
21
+ token: ${{ secrets.GITHUB_TOKEN }}
22
+ fetch-depth: 0 # 完整历史,方便推 tag
21
23
 
22
24
  - name: Set up Node.js
23
- uses: actions/setup-node@v3
25
+ uses: actions/setup-node@v4
24
26
  with:
25
27
  node-version: '18'
26
28
  registry-url: 'https://registry.npmjs.org/'
27
29
 
28
- # 1. 配置 Git 身份(机器人身份)
29
30
  - name: Configure Git
30
31
  run: |
31
32
  git config user.name "GitHub Action"
32
33
  git config user.email "action@github.com"
33
34
 
34
- # 2. 自动增加版本号 (Patch 级别:1.0.0 -> 1.0.1)
35
- # [skip ci] 是为了防止无限循环触发
35
+ # 自动 bump patch 版本:1.1.5 -> 1.1.6
36
+ # [skip ci] 防止这个 commit 再次触发 workflow 形成死循环
36
37
  - name: Bump version
37
38
  run: |
38
- npm version patch -m "苑广山注:自动发布,bump version to %s [skip ci]"
39
+ npm version patch -m "苑广山注:自动发布,升版本号:bump version to %s [skip ci]"
39
40
 
40
- # 3. 把新的版本号推送到 GitHub 仓库
41
+ # 推送 commit + tag 回 GitHub
41
42
  - name: Push changes
42
- run: git push
43
+ run: |
44
+ git push --follow-tags
43
45
 
44
- # 4. 安装依赖
46
+ # 安装依赖
45
47
  - name: Install dependencies
46
48
  run: npm ci
47
49
 
48
- # 5. 发布到 npm
50
+ # 发布到 npm
49
51
  - name: Publish to npm
50
52
  run: npm publish --provenance
51
53
  env:
package/README.md CHANGED
@@ -68,4 +68,16 @@ Pong 游戏: https://wealth.want.biz/pages/pong.html
68
68
 
69
69
  ## 维护者
70
70
 
71
- @yuanguangshan
71
+ @yuanguangshan
72
+
73
+
74
+ ## 自动发布(CI/CD)
75
+
76
+ 本项目使用 GitHub Actions 实现了自动发布流程:
77
+
78
+ - 每次向 `main` 分支 `git push`:
79
+ - 自动执行 `npm version patch`,提升补丁版本号(例如 `1.1.5 -> 1.1.6`);
80
+ - 自动生成对应的 Git tag(如 `v1.1.6`)并推送回仓库;
81
+ - 自动运行 `npm publish --provenance` 发布到 npm。
82
+
83
+ 这样日常开发只需要专注写代码和推送到 `main`,发布和版本管理都由 CI 自动完成。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yuangs",
3
- "version": "1.3.7",
3
+ "version": "1.3.8",
4
4
  "description": "苑广山的个人应用集合 CLI(彩色版)",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -20,6 +20,9 @@
20
20
  "type": "git",
21
21
  "url": "git+https://github.com/yuanguangshan/npm_yuangs.git"
22
22
  },
23
+ "bugs": {
24
+ "url": "https://github.com/yuanguangshan/npm_yuangs/issues"
25
+ },
23
26
  "author": "yuanguangshan",
24
27
  "license": "ISC",
25
28
  "dependencies": {