gm-printer 10.41.9 → 10.41.10-beta.161

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.
@@ -7,6 +7,15 @@ on:
7
7
  push:
8
8
  tags:
9
9
  - 'v*'
10
+ # 分支推送自动发 beta 预发布包(供宿主灰度/验证):
11
+ # - hotfix/**、hotfix-*:hotfix 分支(从全量版本对应 tag 拉出),patch+1 版本
12
+ # - feature/latest*、release/**、release-*:周期分支,minor+1 版本
13
+ branches:
14
+ - 'hotfix/**'
15
+ - 'hotfix-*'
16
+ - 'feature/latest*'
17
+ - 'release/**'
18
+ - 'release-*'
10
19
 
11
20
  jobs:
12
21
  release:
@@ -22,29 +31,64 @@ jobs:
22
31
  node-version: 16.x
23
32
  registry-url: 'https://registry.npmjs.org'
24
33
 
25
-
26
-
27
34
  - name: Setup
28
35
  run: npm i -g @antfu/ni@29.0.0
29
36
 
30
37
  - name: Install
31
38
  run: nci
32
39
 
40
+ # 分支推送时自动生成预发布版本号(只用于本次发布,不改分支上的文件;run_number 保证每次推送唯一):
41
+ # - hotfix 分支: patch+1,如 10.41.9 -> 10.41.10-beta.N,一个 hotfix 分支只对应一个修复版本
42
+ # - 周期分支: minor+1,如 10.41.9 -> 10.42.0-beta.N,与 hotfix 的 patch 序列隔离
43
+ - name: Bump pre-release version
44
+ if: startsWith(github.ref, 'refs/heads/')
45
+ run: |
46
+ if [[ ${{ github.ref }} == refs/heads/hotfix* ]]; then
47
+ VERSION=$(node -p "const p = require('./package.json').version.split('-')[0].split('.'); p[2] = Number(p[2]) + 1; p.join('.')")
48
+ else
49
+ VERSION=$(node -p "const p = require('./package.json').version.split('-')[0].split('.'); p[1] = Number(p[1]) + 1; p[2] = 0; p.join('.')")
50
+ fi
51
+ VERSION="$VERSION-beta.${{ github.run_number }}"
52
+ npm version "$VERSION" --no-git-tag-version
53
+ echo "本次分支推送发布版本: $VERSION (dist-tag: beta)" | tee -a "$GITHUB_STEP_SUMMARY"
54
+
55
+ # hotfix 发布前差异审查:列出包内相对 npm 全量(latest)版本的全部提交,写入 Actions Summary。
56
+ # hotfix 包应只包含目标修复提交;若清单中出现周期需求提交,说明分支基线不对,应停止发布。
57
+ - name: Audit commits vs npm latest
58
+ if: startsWith(github.ref, 'refs/heads/hotfix')
59
+ run: |
60
+ LATEST=$(npm dist-tag ls gm-printer | awk '/^latest:/ {print $2}')
61
+ if [ -n "$LATEST" ] && git rev-parse -q --verify "v$LATEST" >/dev/null; then
62
+ {
63
+ echo "## Hotfix 差异审查(npm latest: v$LATEST)"
64
+ echo "hotfix 包应只包含目标修复提交,以下为 v$LATEST..HEAD 的全部提交:"
65
+ echo '```'
66
+ git log --oneline "v$LATEST..HEAD"
67
+ echo '```'
68
+ } >> "$GITHUB_STEP_SUMMARY"
69
+ else
70
+ echo "## Hotfix 差异审查:未找到全量版本 v$LATEST 对应的本地 tag,跳过" >> "$GITHUB_STEP_SUMMARY"
71
+ fi
72
+
33
73
  - name: Build
34
74
  run: npm run build
35
75
 
36
76
  - name: Release
37
77
  run: |
38
- if [[ ${{ github.ref }} == *refs/tags/*-beta* ]]; then
39
- npm publish --tag beta
40
- elif [[ ${{ github.ref }} == *refs/tags/*-alpha* ]]; then
41
- npm publish --tag alpha
78
+ if [[ ${{ github.ref }} == refs/tags/* ]]; then
79
+ if [[ ${{ github.ref }} == *-beta* ]]; then
80
+ npm publish --tag beta
81
+ elif [[ ${{ github.ref }} == *-alpha* ]]; then
82
+ npm publish --tag alpha
83
+ else
84
+ npm publish
85
+ fi
42
86
  else
43
- npm publish
87
+ npm publish --tag beta
44
88
  fi
45
89
  env:
46
90
  NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
47
91
  # - name: ChangeLog
48
92
  # run: npx changelogithub
49
93
  # env:
50
- # GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
94
+ # GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}