chore: update version to 2.2.1-alpha and add alpha update logs

refactor: simplify version change detection in alpha workflow

chore: alpha delete old release then release new one

fix: update alpha workflow to handle missing ALPHA_LOGS and improve release notes generation

fix: update job dependencies in alpha workflow to include delete_otld_release
This commit is contained in:
Tunglies 2025-03-20 18:35:01 +08:00
parent d6dd89b674
commit 167edcf8ef
6 changed files with 88 additions and 38 deletions

View File

@ -25,7 +25,7 @@ jobs:
with:
fetch-depth: 2
- name: Check if commit changed
- name: Check if version changed
id: check
run: |
# For manual workflow_dispatch, always run
@ -34,21 +34,44 @@ jobs:
exit 0
fi
# Check if current commit is different from the previous one
CURRENT_COMMIT=$(git rev-parse HEAD)
PREVIOUS_COMMIT=$(git rev-parse HEAD~1)
# Store current version from package.json
CURRENT_VERSION=$(cat package.json | jq -r '.version')
echo "Current version: $CURRENT_VERSION"
if [ "$CURRENT_COMMIT" != "$PREVIOUS_COMMIT" ]; then
echo "New commit detected: $CURRENT_COMMIT"
# Get the previous commit's package.json version
git checkout HEAD~1 package.json
PREVIOUS_VERSION=$(cat package.json | jq -r '.version')
echo "Previous version: $PREVIOUS_VERSION"
# Reset back to current commit
git checkout HEAD package.json
# Check if version changed
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
echo "Version changed from $PREVIOUS_VERSION to $CURRENT_VERSION"
echo "should_run=true" >> $GITHUB_OUTPUT
else
echo "No new commits since last run"
echo "Version unchanged: $CURRENT_VERSION"
echo "should_run=false" >> $GITHUB_OUTPUT
fi
alpha:
delete_old_release:
needs: check_commit
if: ${{ needs.check_commit.outputs.should_run == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Delete Old Alpha Release
uses: dev-drprasad/delete-tag-and-release@v1.1
with:
tag_name: alpha
delete_release: true
repo: ${{ github.repository }}
github_token: ${{ secrets.GITHUB_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
alpha:
needs: delete_old_release
strategy:
fail-fast: false
matrix:
@ -103,9 +126,6 @@ jobs:
pnpm i
pnpm check ${{ matrix.target }}
- name: Alpha Version update
run: pnpm run fix-alpha-version
- name: Tauri build
uses: tauri-apps/tauri-action@v0
env:
@ -129,8 +149,7 @@ jobs:
args: --target ${{ matrix.target }}
alpha-for-linux-arm:
needs: check_commit
if: ${{ needs.check_commit.outputs.should_run == 'true' }}
needs: delete_old_release
strategy:
fail-fast: false
matrix:
@ -252,8 +271,7 @@ jobs:
src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm
alpha-for-fixed-webview2:
needs: check_commit
if: ${{ needs.check_commit.outputs.should_run == 'true' }}
needs: delete_old_release
strategy:
fail-fast: false
matrix:
@ -351,26 +369,50 @@ jobs:
update_tag:
name: Update tag
runs-on: ubuntu-latest
needs: [check_commit, alpha, alpha-for-linux-arm, alpha-for-fixed-webview2]
if: ${{ needs.check_commit.outputs.should_run == 'true' }}
needs: [delete_old_release, alpha, alpha-for-linux-arm, alpha-for-fixed-webview2]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Fetch Alpha update logs
id: fetch_alpha_logs
run: |
# Check if UPDATELOG.md exists
if [ -f "UPDATELOG.md" ]; then
# Extract the section starting with ## and containing -alpha until the next ## or end of file
ALPHA_LOGS=$(awk '/^## .*-alpha/{flag=1; print; next} /^## /{flag=0} flag' UPDATELOG.md)
if [ -n "$ALPHA_LOGS" ]; then
echo "Found alpha update logs"
echo "ALPHA_LOGS<<EOF" >> $GITHUB_ENV
echo "$ALPHA_LOGS" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
else
echo "No alpha sections found in UPDATELOG.md"
fi
else
echo "UPDATELOG.md file not found"
fi
shell: bash
- name: Set Env
run: |
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
shell: bash
# - name: Update Tag
# uses: richardsimko/update-tag@v1
# with:
# tag_name: alpha
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
cat > release.txt << 'EOF'
# 检查 ALPHA_LOGS 是否存在,如果不存在则使用默认消息
if [ -z "$ALPHA_LOGS" ]; then
echo "No alpha logs found, using default message"
ALPHA_LOGS="More new features are now supported. Check for detailed changelog soon."
else
echo "Using found alpha logs"
fi
# 生成 release.txt 文件
cat > release.txt << EOF
$ALPHA_LOGS
## 我应该下载哪个版本?
### MacOS
@ -398,7 +440,7 @@ jobs:
### 稳定机场VPN推荐
- [狗狗加速](https://verge.dginv.click/#/register?code=oaxsAGo6)
Created at ${{ env.BUILDTIME }}.
Created at ${{ env.BUILDTIME }}.
EOF
- name: Upload Release

View File

@ -1,3 +1,11 @@
## v2.2.1-alpha
**发行代号:拓**
#### 修复
1. **系统**
- 修复 MacOS 无法使用快捷键粘贴/选择/复制订阅地址。
## v2.2.0
**发行代号:拓**

View File

@ -1,6 +1,6 @@
{
"name": "clash-verge",
"version": "2.2.0",
"version": "2.2.1-alpha",
"license": "GPL-3.0-only",
"scripts": {
"dev": "cross-env RUST_BACKTRACE=1 tauri dev -f verge-dev -- --profile fast-dev",

2
src-tauri/Cargo.lock generated
View File

@ -1132,7 +1132,7 @@ dependencies = [
[[package]]
name = "clash-verge"
version = "2.1.2"
version = "2.2.1-alpha"
dependencies = [
"ab_glyph",
"aes-gcm",

View File

@ -1,6 +1,6 @@
[package]
name = "clash-verge"
version = "2.1.2"
version = "2.2.1-alpha"
description = "clash verge"
authors = ["zzzgydi", "wonfen", "MystiPanda"]
license = "GPL-3.0-only"

View File

@ -1,5 +1,5 @@
{
"version": "2.2.0",
"version": "2.2.1-alpha",
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"bundle": {
"active": true,