Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/ci_bump_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Bump Version

on:
workflow_dispatch:
inputs:
version:
description: '新版本号 (如 v2026.2.1)'
required: true

jobs:
bump:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }} # 需要一个具有写权限的个人访问令牌

- name: Set new version to env
run: |
echo "NEW_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
echo "NEW_VERSION_DATE=$(date +'%Y/%m/%d')" >> $GITHUB_ENV

- name: Validate version format
run: |
VERSION="${{ github.event.inputs.version }}"
if ! echo "$VERSION" | grep -qE '^v[0-9]{4}\.[0-9]{1,2}(\.[0-9]+)?(-rc[0-9]+)?$'; then
echo "版本格式错误,应为 v2026.2.1 或 v2026.2.1-rc1"
exit 1
fi

- name: Set version without v
run: |
VERSION="${{ github.event.inputs.version }}"
echo "NEW_VERSION_WITHOUT_V=${VERSION#v}" >> $GITHUB_ENV

- name: Update devel/200_22.md
run: |
sed -i "3i## ${{ env.NEW_VERSION_DATE }} ${{ env.NEW_VERSION }} 打包" devel/200_22.md

- name: Update xmake/vars.lua and Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

sed -i 's/^XMACS_VERSION="[^"]*"/XMACS_VERSION="${{ env.NEW_VERSION_WITHOUT_V }}"/' xmake/vars.lua

git add .
git commit -m "[200_22] bump to Mogan STEM ${{ env.NEW_VERSION }}"
# 打 Tag
git tag ${{ env.NEW_VERSION }}

git push origin ${{ github.ref_name }}
git push origin ${{ env.NEW_VERSION }}
38 changes: 38 additions & 0 deletions devel/200_50.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 200_50 Bump Version workflow

## 触发方式
- 通过 GitHub Actions 手动触发(workflow_dispatch)
- 输入新版本号(如 v2026.2.2)

## 版本号规则
- 格式:`vYYYY.Major.Minor[-rcN]`
- 示例:`v2026.2.1``v2026.2.1-rc1`

## 涉及文件
- `xmake/vars.lua`:更新 XMACS_VERSION
- `devel/200_22.md`:添加版本发布记录

## 2026/03/18 添加 Bump Version workflow

### What
- 新增 GitHub Actions workflow:`.github/workflows/ci_bump_version.yml`
- 手动触发版本号更新,自动完成以下工作:
1. 验证版本号格式
2.`devel/200_22.md` 第3行插入新版本记录
3. 更新 `xmake/vars.lua` 中的 XMACS_VERSION
4. 自动提交并推送到远程仓库

### Why
- 简化版本发布流程,统一管理版本号
- 确保版本号在多个文件中保持一致
- 减少手动操作带来的错误

### How
1. 在 GitHub 仓库的 Actions 页面,选择 "Bump Version" workflow
2. 点击 "Run workflow" 按钮
3. 输入新版本号(如 `v2026.2.2`
4. 点击 "Run workflow" 确认执行

### 版本号格式验证
- 标准格式:`v2026.2.1``v2026.2.1-rc1`
- 正则表达式:`^v[0-9]{4}\.[0-9]{1,2}(\.[0-9]+)?(-rc[0-9]+)?$`