From 167edcf8efa04029b32aa6be582795a87c23ab67 Mon Sep 17 00:00:00 2001 From: Tunglies Date: Thu, 20 Mar 2025 18:35:01 +0800 Subject: [PATCH] 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 --- .github/workflows/alpha.yml | 110 +++++++++++++++++++++++++----------- UPDATELOG.md | 8 +++ package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- 6 files changed, 88 insertions(+), 38 deletions(-) diff --git a/.github/workflows/alpha.yml b/.github/workflows/alpha.yml index 6258de30..c79037fc 100644 --- a/.github/workflows/alpha.yml +++ b/.github/workflows/alpha.yml @@ -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) - - if [ "$CURRENT_COMMIT" != "$PREVIOUS_COMMIT" ]; then - echo "New commit detected: $CURRENT_COMMIT" + # Store current version from package.json + CURRENT_VERSION=$(cat package.json | jq -r '.version') + echo "Current version: $CURRENT_VERSION" + + # 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,37 +369,61 @@ 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<> $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 - MacOS intel芯片: x64.dmg - MacOS apple M芯片: aarch64.dmg - + ### Linux - Linux 64位: amd64.deb/amd64.rpm - Linux arm64 architecture: arm64.deb/aarch64.rpm - Linux armv7架构: armhf.deb/armhfp.rpm - + ### Windows (不再支持Win7) #### 正常版本(推荐) - 64位: x64-setup.exe @@ -390,15 +432,15 @@ jobs: #### 内置Webview2版(体积较大,仅在企业版系统或无法安装webview2时使用) - 64位: x64_fixed_webview2-setup.exe - arm64架构: arm64_fixed_webview2-setup.exe - + ### FAQ - [常见问题](https://clash-verge-rev.github.io/faq/windows.html) ### 稳定机场VPN推荐 - [狗狗加速](https://verge.dginv.click/#/register?code=oaxsAGo6) - - Created at ${{ env.BUILDTIME }}. + + Created at ${{ env.BUILDTIME }}. EOF - name: Upload Release @@ -409,4 +451,4 @@ jobs: body_path: release.txt prerelease: true token: ${{ secrets.GITHUB_TOKEN }} - generate_release_notes: true + generate_release_notes: true \ No newline at end of file diff --git a/UPDATELOG.md b/UPDATELOG.md index b8bc3143..8fb8c68b 100644 --- a/UPDATELOG.md +++ b/UPDATELOG.md @@ -1,3 +1,11 @@ +## v2.2.1-alpha +**发行代号:拓** + +#### 修复 +1. **系统** + - 修复 MacOS 无法使用快捷键粘贴/选择/复制订阅地址。 + + ## v2.2.0 **发行代号:拓** diff --git a/package.json b/package.json index f058fe6c..88a5ca7d 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 8f29d86c..3355231e 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1132,7 +1132,7 @@ dependencies = [ [[package]] name = "clash-verge" -version = "2.1.2" +version = "2.2.1-alpha" dependencies = [ "ab_glyph", "aes-gcm", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 39aef01b..ede1ba4a 100755 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -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" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index b2fa9112..78608eef 100755 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -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,