Skip to content

Commit e0d0268

Browse files
committed
ci: test
1 parent 74c6872 commit e0d0268

File tree

2 files changed

+38
-52
lines changed

2 files changed

+38
-52
lines changed

.github/workflows/relese.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,44 @@ jobs:
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

.github/workflows/version.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)