File tree Expand file tree Collapse file tree 2 files changed +38
-52
lines changed Expand file tree Collapse file tree 2 files changed +38
-52
lines changed Original file line number Diff line number Diff line change 1111 name : Release
1212 runs-on : ubuntu-latest
1313 steps :
14- - uses : actions/checkout@v3
14+ - uses : actions/checkout@v4
15+
16+ - name : Check file versions
17+ run : |
18+ files="ezuikit.js index.js index.mjs package.json"
19+
20+ version=""
21+ inconsistent=false
22+
23+ for file in $files; do
24+ if [ ! -f "$file" ]; then
25+ echo "缺少文件: $file"
26+ inconsistent=true
27+ continue
28+ fi
29+ v=$(head -3 "$file" | grep -Eo '([0-9]+\.[0-9]+\.[0-9]+)+(-[a-z]+\.[0-9]+)?')
30+ if [ -z "$v" ]; then
31+ echo "文件 $file 未检测到版本号"
32+ inconsistent=true
33+ continue
34+ fi
35+ if [ -z "$version" ]; then
36+ version="$v"
37+ else
38+ if [ "$version" != "$v" ]; then
39+ echo "文件 $file 的版本号 $v 与其它文件版本号 $version 不一致"
40+ inconsistent=true
41+ fi
42+ fi
43+ done
44+
45+ if [ "$inconsistent" = true ]; then
46+ echo "版本号不一致,禁止推送!"
47+ exit 1
48+ fi
49+
50+ echo "所有文件版本号一致: $version"
51+
1552 # # 设置 pnpm
1653 # - name: Setup PNPM
1754 # uses: pnpm/action-setup@v2
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments