Skip to content

Commit 352b0c1

Browse files
committed
优化测试版本命名格式
1 parent 1d385ba commit 352b0c1

4 files changed

Lines changed: 14 additions & 32 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ jobs:
4747
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
4848
echo "$CHANGELOG" >> $GITHUB_ENV
4949
echo "EOF" >> $GITHUB_ENV
50+
51+
# 获取composer.json中的当前版本号
52+
if [ -f "composer.json" ]; then
53+
CURRENT_VERSION=$(grep -oP '(?<="version": ")[0-9]+\.[0-9]+\.[0-9]+' composer.json)
54+
if [ -n "$CURRENT_VERSION" ]; then
55+
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
56+
fi
57+
fi
5058
5159
# 为PR创建预发布版本
5260
- name: 为PR创建预发布版本
@@ -70,8 +78,9 @@ jobs:
7078
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
7179
uses: softprops/action-gh-release@v1
7280
with:
73-
tag_name: update-${{ github.sha }}
74-
name: 更新版本 ${{ github.sha }}
81+
# 优先使用composer版本号,如果不存在则使用SHA值
82+
tag_name: update-${{ env.CURRENT_VERSION || github.sha }}
83+
name: 更新版本 ${{ env.CURRENT_VERSION || github.sha }}
7584
draft: false
7685
prerelease: true
7786
body: |
@@ -88,8 +97,9 @@ jobs:
8897
if: github.ref == 'refs/heads/test-workflow' && github.event_name == 'push'
8998
uses: softprops/action-gh-release@v1
9099
with:
91-
tag_name: test-${{ github.sha }} # 使用完整SHA作为标签确保唯一性
92-
name: 测试版本 ${{ substr(github.sha, 0, 8) }} # 使用SHA前缀提高可读性
100+
# 优先使用composer版本号,如果不存在则使用SHA值
101+
tag_name: test-${{ env.CURRENT_VERSION || github.sha }}
102+
name: 测试版本 ${{ env.CURRENT_VERSION || github.sha }}
93103
draft: false
94104
prerelease: true
95105
body: |

README.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +0,0 @@
1-
# Plugin
2-
3-
这是一个基础的Git包模板。
4-
5-
## 功能
6-
- 提供基础的包结构
7-
- 包含.gitignore文件
8-
- 适合作为插件开发的起点
9-
10-
## 安装
11-
```bash
12-
git clone <repository-url>
13-
cd plugin
14-
```
15-
16-
## 使用
17-
根据具体需求修改和扩展此包。

test-workflow-test.md

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

test-workflow-v2.md

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

0 commit comments

Comments
 (0)