From 4bc281ce98fa1b1d8e0e01e7086eaa85fcc0f1cd Mon Sep 17 00:00:00 2001 From: LazyIonEs Date: Thu, 13 Nov 2025 10:47:36 +0800 Subject: [PATCH 01/10] =?UTF-8?q?refactor(ci):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E6=B5=81=E7=A8=8B=E4=B8=8E=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E5=81=A5=E5=A3=AE=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 升级 macOS 构建镜像版本,使用 `macos-15-intel` 和 `macos-latest` 替代 `macos-13` 和 `macos-14` - 移除冗余的 JDK 安装步骤,以简化工作流配置 - 增强文件重命名脚本的健壮性,通过动态查找替代硬编码路径,避免因版本号变化导致构建失败 --- .github/workflows/build-release.yml | 100 +++++++++++++++++++++------- 1 file changed, 75 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index e0d37cc..2a63b60 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -10,27 +10,11 @@ jobs: create-release-distribution: strategy: matrix: - os: [ windows-latest , ubuntu-latest , macos-13 , macos-14 ] + os: [ windows-latest , ubuntu-latest , macos-15-intel , macos-latest ] runs-on: ${{ matrix.os }} name: Create Release Distribution steps: - - if: matrix.os != 'macos-14' - name: Setup Jdk - uses: actions/setup-java@v4 - with: - distribution: "zulu" - java-version: "21" - architecture: x64 - - - if: matrix.os == 'macos-14' - name: Setup Jdk - uses: actions/setup-java@v4 - with: - distribution: "zulu" - java-version: "21" - architecture: aarch64 - - name: Checkout uses: actions/checkout@v4 @@ -40,25 +24,91 @@ jobs: - if: matrix.os == 'windows-latest' name: Rename File run: | - $ErrorActionPreference = "Stop" - mv D:\a\AndroidToolKit\AndroidToolKit\composeApp\output\main-release\msi\AndroidToolKit-${{ inputs.tag_version }}.msi D:\a\AndroidToolKit\AndroidToolKit\composeApp\output\main-release\msi\AndroidToolKit-windows-x64.msi - mv D:\a\AndroidToolKit\AndroidToolKit\composeApp\output\main-release\exe\AndroidToolKit-${{ inputs.tag_version }}.exe D:\a\AndroidToolKit\AndroidToolKit\composeApp\output\main-release\exe\AndroidToolKit-windows-x64.exe + $basePath = "D:\a\AndroidToolKit\AndroidToolKit\composeApp\output\main-release" + + Write-Host "🔍 Searching for MSI and EXE files..." + + # 查找 .msi 文件 + $msi = Get-ChildItem -Path "$basePath\msi" -Filter "*.msi" -File -ErrorAction SilentlyContinue | Select-Object -First 1 + # 查找 .exe 文件 + $exe = Get-ChildItem -Path "$basePath\exe" -Filter "*.exe" -File -ErrorAction SilentlyContinue | Select-Object -First 1 + + if ($null -ne $msi) { + $msiDest = "$basePath\msi\AndroidToolKit-windows-x64.msi" + Write-Host "Renaming $($msi.FullName) -> $msiDest" + Move-Item -Path $msi.FullName -Destination $msiDest -Force + } else { + Write-Warning "⚠️ No .msi file found in $basePath\msi" + } + + if ($null -ne $exe) { + $exeDest = "$basePath\exe\AndroidToolKit-windows-x64.exe" + Write-Host "Renaming $($exe.FullName) -> $exeDest" + Move-Item -Path $exe.FullName -Destination $exeDest -Force + } else { + Write-Warning "⚠️ No .exe file found in $basePath\exe" + } + + Write-Host "✅ Rename complete." - if: matrix.os == 'ubuntu-latest' name: Rename File run: | - mv /home/runner/work/AndroidToolKit/AndroidToolKit/composeApp/output/main-release/deb/androidtoolkit_${{ inputs.tag_version }}-1_amd64.deb /home/runner/work/AndroidToolKit/AndroidToolKit/composeApp/output/main-release/deb/AndroidToolKit-linux-amd64.deb - mv /home/runner/work/AndroidToolKit/AndroidToolKit/composeApp/output/main-release/rpm/androidtoolkit-${{ inputs.tag_version }}-1.x86_64.rpm /home/runner/work/AndroidToolKit/AndroidToolKit/composeApp/output/main-release/rpm/AndroidToolKit-linux-x86_64.rpm + set -e # 出错立即终止 + BASE_PATH="/home/runner/work/AndroidToolKit/AndroidToolKit/composeApp/output/main-release" + + echo "🔍 Searching for DEB and RPM files..." + + DEB_SRC=$(find "$BASE_PATH/deb" -type f -name "*.deb" | head -n 1 || true) + RPM_SRC=$(find "$BASE_PATH/rpm" -type f -name "*.rpm" | head -n 1 || true) + + if [ -z "$DEB_SRC" ]; then + echo "⚠️ No .deb file found in $BASE_PATH/deb" + else + DEB_DEST="$BASE_PATH/deb/AndroidToolKit-linux-amd64.deb" + echo "Renaming: $DEB_SRC -> $DEB_DEST" + mv "$DEB_SRC" "$DEB_DEST" + fi + + if [ -z "$RPM_SRC" ]; then + echo "⚠️ No .rpm file found in $BASE_PATH/rpm" + else + RPM_DEST="$BASE_PATH/rpm/AndroidToolKit-linux-x86_64.rpm" + echo "Renaming: $RPM_SRC -> $RPM_DEST" + mv "$RPM_SRC" "$RPM_DEST" + fi + + echo "✅ Rename complete." - if: matrix.os == 'macos-13' name: Rename File run: | - mv /Users/runner/work/AndroidToolKit/AndroidToolKit/composeApp/output/main-release/dmg/AndroidToolKit-${{ inputs.tag_version }}.dmg /Users/runner/work/AndroidToolKit/AndroidToolKit/composeApp/output/main-release/dmg/AndroidToolKit-macos-x64.dmg + set -e + BASE_PATH="/Users/runner/work/AndroidToolKit/AndroidToolKit/composeApp/output/main-release" + echo "🔍 Searching for macOS build artifacts..." + + DMG_SRC=$(find "$BASE_PATH/dmg" -type f -name "*.dmg" | head -n 1 || true) + if [ -n "$DMG_SRC" ]; then + mv "$DMG_SRC" "$BASE_PATH/dmg/AndroidToolKit-macos-x64.dmg" + echo "✅ Renamed DMG -> AndroidToolKit-macos-x64.dmg" + else + echo "⚠️ No .dmg file found" + fi - if: matrix.os == 'macos-14' name: Rename File run: | - mv /Users/runner/work/AndroidToolKit/AndroidToolKit/composeApp/output/main-release/dmg/AndroidToolKit-${{ inputs.tag_version }}.dmg /Users/runner/work/AndroidToolKit/AndroidToolKit/composeApp/output/main-release/dmg/AndroidToolKit-macos-arm64.dmg + set -e + BASE_PATH="/Users/runner/work/AndroidToolKit/AndroidToolKit/composeApp/output/main-release" + echo "🔍 Searching for macOS build artifacts..." + + DMG_SRC=$(find "$BASE_PATH/dmg" -type f -name "*.dmg" | head -n 1 || true) + if [ -n "$DMG_SRC" ]; then + mv "$DMG_SRC" "$BASE_PATH/dmg/AndroidToolKit-macos-arm64.dmg" + echo "✅ Renamed DMG -> AndroidToolKit-macos-arm64.dmg" + else + echo "⚠️ No .dmg file found" + fi - if: matrix.os == 'windows-latest' name: Draft Release @@ -80,7 +130,7 @@ jobs: artifacts: "composeApp/output/main-release/deb/*,composeApp/output/main-release/rpm/*" token: ${{ secrets.GH_TOKEN }} - - if: matrix.os == 'macos-13' || matrix.os == 'macos-14' + - if: matrix.os == 'macos-15-intel' || matrix.os == 'macos-latest' name: Draft Release uses: ncipollo/release-action@v1 with: From c962bad8d4e06e69f518123cb11e3d85795e89db Mon Sep 17 00:00:00 2001 From: LazyIonEs Date: Thu, 13 Nov 2025 11:04:52 +0800 Subject: [PATCH 02/10] =?UTF-8?q?ci(workflow):=20=E6=9B=B4=E6=96=B0=20macO?= =?UTF-8?q?S=20CI=20=E6=9E=84=E5=BB=BA=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 x86 架构的构建环境从 `macos-13` 升级到 `macos-15-intel` - 将 arm64 架构的构建环境从 `macos-14` 升级到 `macos-latest` --- .github/workflows/build-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 2a63b60..b2526d4 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -80,7 +80,7 @@ jobs: echo "✅ Rename complete." - - if: matrix.os == 'macos-13' + - if: matrix.os == 'macos-15-intel' name: Rename File run: | set -e @@ -95,7 +95,7 @@ jobs: echo "⚠️ No .dmg file found" fi - - if: matrix.os == 'macos-14' + - if: matrix.os == 'macos-latest' name: Rename File run: | set -e From 6b86c35fc8f69cdd7ad349984896e131da15bd89 Mon Sep 17 00:00:00 2001 From: LazyIonEs Date: Thu, 13 Nov 2025 11:44:10 +0800 Subject: [PATCH 03/10] =?UTF-8?q?feat(ci):=20=E6=96=B0=E5=A2=9E=20Windows?= =?UTF-8?q?=20ARM64=20=E4=B8=8E=20Linux=20ARM64=20=E6=9E=B6=E6=9E=84?= =?UTF-8?q?=E7=9A=84=E6=9E=84=E5=BB=BA=E4=B8=8E=E5=8F=91=E5=B8=83=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在构建矩阵中增加 `windows-11-arm` 和 `ubuntu-24.04-arm` 两个操作系统,以支持 ARM64 架构。 - 为新的 ARM64 平台添加文件重命名脚本,将构建产物(`.msi`, `.exe`, `.deb`, `.rpm`)重命名为包含架构标识的格式。 - 更新发布步骤(Draft Release),将 Windows 和 Linux 的 ARM64 构建产物包含进草稿版本中。 --- .github/workflows/build-release.yml | 65 +++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index b2526d4..7fbdaf3 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -10,7 +10,7 @@ jobs: create-release-distribution: strategy: matrix: - os: [ windows-latest , ubuntu-latest , macos-15-intel , macos-latest ] + os: [ windows-latest, windows-11-arm, ubuntu-latest, ubuntu-24.04-arm, macos-15-intel, macos-latest ] runs-on: ${{ matrix.os }} name: Create Release Distribution @@ -51,6 +51,36 @@ jobs: Write-Host "✅ Rename complete." + - if: matrix.os == 'windows-11-arm' + name: Rename File + run: | + $basePath = "D:\a\AndroidToolKit\AndroidToolKit\composeApp\output\main-release" + + Write-Host "🔍 Searching for MSI and EXE files..." + + # 查找 .msi 文件 + $msi = Get-ChildItem -Path "$basePath\msi" -Filter "*.msi" -File -ErrorAction SilentlyContinue | Select-Object -First 1 + # 查找 .exe 文件 + $exe = Get-ChildItem -Path "$basePath\exe" -Filter "*.exe" -File -ErrorAction SilentlyContinue | Select-Object -First 1 + + if ($null -ne $msi) { + $msiDest = "$basePath\msi\AndroidToolKit-windows-arm64.msi" + Write-Host "Renaming $($msi.FullName) -> $msiDest" + Move-Item -Path $msi.FullName -Destination $msiDest -Force + } else { + Write-Warning "⚠️ No .msi file found in $basePath\msi" + } + + if ($null -ne $exe) { + $exeDest = "$basePath\exe\AndroidToolKit-windows-arm64.exe" + Write-Host "Renaming $($exe.FullName) -> $exeDest" + Move-Item -Path $exe.FullName -Destination $exeDest -Force + } else { + Write-Warning "⚠️ No .exe file found in $basePath\exe" + } + + Write-Host "✅ Rename complete." + - if: matrix.os == 'ubuntu-latest' name: Rename File run: | @@ -80,6 +110,35 @@ jobs: echo "✅ Rename complete." + - if: matrix.os == 'ubuntu-24.04-arm' + name: Rename File + run: | + set -e # 出错立即终止 + BASE_PATH="/home/runner/work/AndroidToolKit/AndroidToolKit/composeApp/output/main-release" + + echo "🔍 Searching for DEB and RPM files..." + + DEB_SRC=$(find "$BASE_PATH/deb" -type f -name "*.deb" | head -n 1 || true) + RPM_SRC=$(find "$BASE_PATH/rpm" -type f -name "*.rpm" | head -n 1 || true) + + if [ -z "$DEB_SRC" ]; then + echo "⚠️ No .deb file found in $BASE_PATH/deb" + else + DEB_DEST="$BASE_PATH/deb/AndroidToolKit-linux-arm64.deb" + echo "Renaming: $DEB_SRC -> $DEB_DEST" + mv "$DEB_SRC" "$DEB_DEST" + fi + + if [ -z "$RPM_SRC" ]; then + echo "⚠️ No .rpm file found in $BASE_PATH/rpm" + else + RPM_DEST="$BASE_PATH/rpm/AndroidToolKit-linux-aarch64.rpm" + echo "Renaming: $RPM_SRC -> $RPM_DEST" + mv "$RPM_SRC" "$RPM_DEST" + fi + + echo "✅ Rename complete." + - if: matrix.os == 'macos-15-intel' name: Rename File run: | @@ -110,7 +169,7 @@ jobs: echo "⚠️ No .dmg file found" fi - - if: matrix.os == 'windows-latest' + - if: matrix.os == 'windows-latest' || matrix.os == 'windows-11-arm' name: Draft Release uses: ncipollo/release-action@v1 with: @@ -120,7 +179,7 @@ jobs: artifacts: "composeApp/output/main-release/msi/*,composeApp/output/main-release/exe/*" token: ${{ secrets.GH_TOKEN }} - - if: matrix.os == 'ubuntu-latest' + - if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm' name: Draft Release uses: ncipollo/release-action@v1 with: From 0217233522916c2d8ea80a722a229ca58e3902b5 Mon Sep 17 00:00:00 2001 From: LazyIonEs Date: Thu, 13 Nov 2025 11:58:15 +0800 Subject: [PATCH 04/10] =?UTF-8?q?refactor(ci):=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=B5=81=E7=A8=8B=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E4=BA=A7=E7=89=A9=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将原有的单个构建发布作业拆分为两个独立的作业:`build-and-rename` 和 `publish-release`。 - `build-and-rename` 作业并行构建所有平台的产物,并使用 `upload-artifact` 统一上传。 - `publish-release` 作业依赖于前者,通过 `download-artifact` 收集所有产物,并一次性创建或更新 Release 草稿。 - 优化矩阵(`matrix`)配置,为每个平台和架构添加明确的 `name` 标识。 - 合并并简化了 Windows、Linux 和 macOS 的产物重命名脚本,通过动态变量(如 `${{ matrix.name }}` 和 `${{ github.workspace }}`)替代硬编码路径和文件名,增强了脚本的健壮性和可复用性。 - 移除了原先在每个矩阵任务中重复执行的 `ncipollo/release-action` 步骤。 --- .github/workflows/build-release.yml | 228 ++++++++++++---------------- 1 file changed, 93 insertions(+), 135 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 7fbdaf3..e836553 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -6,195 +6,153 @@ on: tag_version: description: 'Specify the version tag (required)' required: true + jobs: - create-release-distribution: + # ----------------------------------------------------------------- + # 作业 1:构建、重命名并上传所有平台的产物 + # ----------------------------------------------------------------- + build-and-rename: strategy: matrix: - os: [ windows-latest, windows-11-arm, ubuntu-latest, ubuntu-24.04-arm, macos-15-intel, macos-latest ] + include: + # Windows + - os: windows-latest + name: windows-x64 + - os: windows-11-arm + name: windows-arm64 + # Linux + - os: ubuntu-latest + name: linux-amd64 + rpm_arch: x86_64 + - os: ubuntu-24.04-arm + name: linux-arm64 + rpm_arch: aarch64 + # macOS + - os: macos-15-intel + name: macos-x64 + - os: macos-latest # Apple Silicon + name: macos-arm64 + runs-on: ${{ matrix.os }} - name: Create Release Distribution + name: Build for ${{ matrix.name }} steps: - name: Checkout uses: actions/checkout@v4 - - name: PackageReleaseDistributionForCurrentOS + - name: Package Release Distribution run: ./gradlew packageReleaseDistributionForCurrentOS - - if: matrix.os == 'windows-latest' - name: Rename File + - name: Rename Windows Files + if: runner.os == 'Windows' + shell: pwsh run: | - $basePath = "D:\a\AndroidToolKit\AndroidToolKit\composeApp\output\main-release" + $basePath = "${{ github.workspace }}\composeApp\output\main-release" + $suffix = "${{ matrix.name }}" + Write-Host "🔍 Searching for MSI and EXE files in $basePath for $suffix..." - Write-Host "🔍 Searching for MSI and EXE files..." - - # 查找 .msi 文件 $msi = Get-ChildItem -Path "$basePath\msi" -Filter "*.msi" -File -ErrorAction SilentlyContinue | Select-Object -First 1 - # 查找 .exe 文件 - $exe = Get-ChildItem -Path "$basePath\exe" -Filter "*.exe" -File -ErrorAction SilentlyContinue | Select-Object -First 1 - if ($null -ne $msi) { - $msiDest = "$basePath\msi\AndroidToolKit-windows-x64.msi" + $msiDest = "$basePath\msi\AndroidToolKit-$suffix.msi" Write-Host "Renaming $($msi.FullName) -> $msiDest" Move-Item -Path $msi.FullName -Destination $msiDest -Force } else { - Write-Warning "⚠️ No .msi file found in $basePath\msi" - } - - if ($null -ne $exe) { - $exeDest = "$basePath\exe\AndroidToolKit-windows-x64.exe" - Write-Host "Renaming $($exe.FullName) -> $exeDest" - Move-Item -Path $exe.FullName -Destination $exeDest -Force - } else { - Write-Warning "⚠️ No .exe file found in $basePath\exe" + Write-Warning "⚠️ No .msi file found" } - Write-Host "✅ Rename complete." - - - if: matrix.os == 'windows-11-arm' - name: Rename File - run: | - $basePath = "D:\a\AndroidToolKit\AndroidToolKit\composeApp\output\main-release" - - Write-Host "🔍 Searching for MSI and EXE files..." - - # 查找 .msi 文件 - $msi = Get-ChildItem -Path "$basePath\msi" -Filter "*.msi" -File -ErrorAction SilentlyContinue | Select-Object -First 1 - # 查找 .exe 文件 $exe = Get-ChildItem -Path "$basePath\exe" -Filter "*.exe" -File -ErrorAction SilentlyContinue | Select-Object -First 1 - - if ($null -ne $msi) { - $msiDest = "$basePath\msi\AndroidToolKit-windows-arm64.msi" - Write-Host "Renaming $($msi.FullName) -> $msiDest" - Move-Item -Path $msi.FullName -Destination $msiDest -Force - } else { - Write-Warning "⚠️ No .msi file found in $basePath\msi" - } - if ($null -ne $exe) { - $exeDest = "$basePath\exe\AndroidToolKit-windows-arm64.exe" + $exeDest = "$basePath\exe\AndroidToolKit-$suffix.exe" Write-Host "Renaming $($exe.FullName) -> $exeDest" Move-Item -Path $exe.FullName -Destination $exeDest -Force } else { - Write-Warning "⚠️ No .exe file found in $basePath\exe" + Write-Warning "⚠️ No .exe file found" } + Write-Host "✅ Rename complete for $suffix." - Write-Host "✅ Rename complete." - - - if: matrix.os == 'ubuntu-latest' - name: Rename File + - name: Rename Linux Files + if: runner.os == 'Linux' run: | - set -e # 出错立即终止 - BASE_PATH="/home/runner/work/AndroidToolKit/AndroidToolKit/composeApp/output/main-release" - - echo "🔍 Searching for DEB and RPM files..." - + set -e + BASE_PATH="${{ github.workspace }}/composeApp/output/main-release" + echo "🔍 Searching for DEB and RPM files for ${{ matrix.name }}..." + DEB_SRC=$(find "$BASE_PATH/deb" -type f -name "*.deb" | head -n 1 || true) - RPM_SRC=$(find "$BASE_PATH/rpm" -type f -name "*.rpm" | head -n 1 || true) - - if [ -z "$DEB_SRC" ]; then - echo "⚠️ No .deb file found in $BASE_PATH/deb" - else - DEB_DEST="$BASE_PATH/deb/AndroidToolKit-linux-amd64.deb" - echo "Renaming: $DEB_SRC -> $DEB_DEST" + if [ -n "$DEB_SRC" ]; then + DEB_DEST="$BASE_PATH/deb/AndroidToolKit-${{ matrix.name }}.deb" + echo "Renaming: $DEB_SRC -> $DEB_DEST" mv "$DEB_SRC" "$DEB_DEST" - fi - - if [ -z "$RPM_SRC" ]; then - echo "⚠️ No .rpm file found in $BASE_PATH/rpm" else - RPM_DEST="$BASE_PATH/rpm/AndroidToolKit-linux-x86_64.rpm" - echo "Renaming: $RPM_SRC -> $RPM_DEST" - mv "$RPM_SRC" "$RPM_DEST" + echo "⚠️ No .deb file found" fi - - echo "✅ Rename complete." - - if: matrix.os == 'ubuntu-24.04-arm' - name: Rename File - run: | - set -e # 出错立即终止 - BASE_PATH="/home/runner/work/AndroidToolKit/AndroidToolKit/composeApp/output/main-release" - - echo "🔍 Searching for DEB and RPM files..." - - DEB_SRC=$(find "$BASE_PATH/deb" -type f -name "*.deb" | head -n 1 || true) RPM_SRC=$(find "$BASE_PATH/rpm" -type f -name "*.rpm" | head -n 1 || true) - - if [ -z "$DEB_SRC" ]; then - echo "⚠️ No .deb file found in $BASE_PATH/deb" - else - DEB_DEST="$BASE_PATH/deb/AndroidToolKit-linux-arm64.deb" - echo "Renaming: $DEB_SRC -> $DEB_DEST" - mv "$DEB_SRC" "$DEB_DEST" - fi - - if [ -z "$RPM_SRC" ]; then - echo "⚠️ No .rpm file found in $BASE_PATH/rpm" - else - RPM_DEST="$BASE_PATH/rpm/AndroidToolKit-linux-aarch64.rpm" - echo "Renaming: $RPM_SRC -> $RPM_DEST" + if [ -n "$RPM_SRC" ]; then + RPM_DEST="$BASE_PATH/rpm/AndroidToolKit-${{ matrix.rpm_arch }}.rpm" # 注意这里用了专门的 rpm_arch + echo "Renaming: $RPM_SRC -> $RPM_DEST" mv "$RPM_SRC" "$RPM_DEST" - fi - - echo "✅ Rename complete." - - - if: matrix.os == 'macos-15-intel' - name: Rename File - run: | - set -e - BASE_PATH="/Users/runner/work/AndroidToolKit/AndroidToolKit/composeApp/output/main-release" - echo "🔍 Searching for macOS build artifacts..." - - DMG_SRC=$(find "$BASE_PATH/dmg" -type f -name "*.dmg" | head -n 1 || true) - if [ -n "$DMG_SRC" ]; then - mv "$DMG_SRC" "$BASE_PATH/dmg/AndroidToolKit-macos-x64.dmg" - echo "✅ Renamed DMG -> AndroidToolKit-macos-x64.dmg" else - echo "⚠️ No .dmg file found" + echo "⚠️ No .rpm file found" fi + echo "✅ Rename complete for ${{ matrix.name }}." - - if: matrix.os == 'macos-latest' - name: Rename File + - name: Rename macOS File + if: runner.os == 'macOS' run: | set -e - BASE_PATH="/Users/runner/work/AndroidToolKit/AndroidToolKit/composeApp/output/main-release" - echo "🔍 Searching for macOS build artifacts..." + BASE_PATH="${{ github.workspace }}/composeApp/output/main-release" + echo "🔍 Searching for macOS build artifacts for ${{ matrix.name }}..." DMG_SRC=$(find "$BASE_PATH/dmg" -type f -name "*.dmg" | head -n 1 || true) if [ -n "$DMG_SRC" ]; then - mv "$DMG_SRC" "$BASE_PATH/dmg/AndroidToolKit-macos-arm64.dmg" - echo "✅ Renamed DMG -> AndroidToolKit-macos-arm64.dmg" + DMG_DEST="$BASE_PATH/dmg/AndroidToolKit-${{ matrix.name }}.dmg" + echo "Renaming: $DMG_SRC -> $DMG_DEST" + mv "$DMG_SRC" "$DMG_DEST" else echo "⚠️ No .dmg file found" fi + echo "✅ Rename complete for ${{ matrix.name }}." - - if: matrix.os == 'windows-latest' || matrix.os == 'windows-11-arm' - name: Draft Release - uses: ncipollo/release-action@v1 + # --- 上传产物(为 Job 2 准备)--- + - name: Upload Artifact + uses: actions/upload-artifact@v4 with: - draft: true - allowUpdates: true - tag: "v${{ inputs.tag_version }}" - artifacts: "composeApp/output/main-release/msi/*,composeApp/output/main-release/exe/*" - token: ${{ secrets.GH_TOKEN }} + name: release-assets-${{ matrix.name }} # 每个 job 的产物包名唯一 + path: | # 使用通配符匹配所有重命名后的文件 + ${{ github.workspace }}/composeApp/output/main-release/msi/*.msi + ${{ github.workspace }}/composeApp/output/main-release/exe/*.exe + ${{ github.workspace }}/composeApp/output/main-release/deb/*.deb + ${{ github.workspace }}/composeApp/output/main-release/rpm/*.rpm + ${{ github.workspace }}/composeApp/output/main-release/dmg/*.dmg + if-no-files-found: warn # 如果某个平台没有产物(例如 Linux 没有 .msi)也不要报错 + retention-days: 1 # 只需要保留1天,Job 2 用完就丢 + + # ----------------------------------------------------------------- + # 作业 2:收集所有产物并创建(或更新)一个 Release + # ----------------------------------------------------------------- + publish-release: + name: Publish Draft Release + runs-on: ubuntu-latest + needs: build-and-rename # 关键:等待所有 build-and-rename 任务成功 - - if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm' - name: Draft Release - uses: ncipollo/release-action@v1 + steps: + - name: Download all artifacts + uses: actions/download-artifact@v4 with: - draft: true - allowUpdates: true - tag: "v${{ inputs.tag_version }}" - artifacts: "composeApp/output/main-release/deb/*,composeApp/output/main-release/rpm/*" - token: ${{ secrets.GH_TOKEN }} + path: release-assets # 下载到这个目录 + pattern: release-assets-* # 匹配所有 job 上传的产物 + merge-multiple: true # 关键:将所有产物包合并到 release-assets 目录下 + + - name: List downloaded files (for debugging) + run: | + echo "Listing all downloaded artifacts:" + ls -R release-assets - - if: matrix.os == 'macos-15-intel' || matrix.os == 'macos-latest' - name: Draft Release + - name: Draft Release uses: ncipollo/release-action@v1 with: draft: true allowUpdates: true tag: "v${{ inputs.tag_version }}" - artifacts: "composeApp/output/main-release/dmg/*" + artifacts: "release-assets/*" # 上传下载目录中的所有文件 token: ${{ secrets.GH_TOKEN }} \ No newline at end of file From c8501e013a3d6222cb8b3fbfc21c269066ec667c Mon Sep 17 00:00:00 2001 From: LazyIonEs Date: Thu, 13 Nov 2025 11:58:21 +0800 Subject: [PATCH 05/10] =?UTF-8?q?chore(deps):=20=E5=9B=9E=E6=BB=9A=20compo?= =?UTF-8?q?se-plugin=20=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 `compose-plugin` 从 `1.10.0-alpha03` 回滚到 `1.10.0-alpha02` --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 71ac66a..cc85143 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] compose = "1.6.11" compose-compiler = "1.5.8" -compose-plugin = "1.10.0-alpha03" +compose-plugin = "1.10.0-alpha02" junit = "4.13.2" kotlin = "2.2.21" apksig = "8.11.1" From f2a6d1c0a0ebbbb1cbbb09ca17dab3f05f661880 Mon Sep 17 00:00:00 2001 From: LazyIonEs Date: Thu, 13 Nov 2025 12:47:52 +0800 Subject: [PATCH 06/10] =?UTF-8?q?fix(ci):=20=E4=BF=AE=E5=A4=8D=20RPM=20?= =?UTF-8?q?=E6=9E=B6=E6=9E=84=E5=90=8D=E7=A7=B0=E5=92=8C=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E8=B5=84=E4=BA=A7=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在构建矩阵中为 `rpm_arch` 添加 `linux-` 前缀,修正其命名格式 - 调整版本发布工作流中的 `artifacts` 路径,从 `release-assets/*` 更新为 `release-assets/*/*` 以正确上传构建产物 --- .github/workflows/build-release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index e836553..6661090 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -23,10 +23,10 @@ jobs: # Linux - os: ubuntu-latest name: linux-amd64 - rpm_arch: x86_64 + rpm_arch: linux-x86_64 - os: ubuntu-24.04-arm name: linux-arm64 - rpm_arch: aarch64 + rpm_arch: linux-aarch64 # macOS - os: macos-15-intel name: macos-x64 @@ -154,5 +154,5 @@ jobs: draft: true allowUpdates: true tag: "v${{ inputs.tag_version }}" - artifacts: "release-assets/*" # 上传下载目录中的所有文件 + artifacts: "release-assets/*/*" # 上传下载目录中的所有文件 token: ${{ secrets.GH_TOKEN }} \ No newline at end of file From 84502cdf9b1574c80108d3d92db2ddc5313c19c4 Mon Sep 17 00:00:00 2001 From: LazyIonEs Date: Thu, 13 Nov 2025 13:03:07 +0800 Subject: [PATCH 07/10] =?UTF-8?q?refactor(ci):=20=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E5=8F=91=E5=B8=83=E6=B5=81=E7=A8=8B=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 `workflow_dispatch` 中的手动版本号输入,实现版本号自动获取。 - 新增 `get-version` 作业,用于从 `gradle.properties` 文件中读取 `kitVersion`,并将其作为输出传递给后续作业。 - 调整 `publish-release` 作业,使其从 `get-version` 作业的输出中获取版本标签,不再依赖手动输入。 --- .github/workflows/build-release.yml | 122 ++++++++++++---------------- 1 file changed, 50 insertions(+), 72 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 6661090..705c384 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -2,146 +2,123 @@ name: Build Release on: workflow_dispatch: - inputs: - tag_version: - description: 'Specify the version tag (required)' - required: true jobs: # ----------------------------------------------------------------- - # 作业 1:构建、重命名并上传所有平台的产物 + # 作业 1:获取版本号 + # ----------------------------------------------------------------- + get-version: + name: Get Version + runs-on: ubuntu-latest + outputs: + # 将版本号定义为作业输出 + version_tag: ${{ steps.get_version.outputs.version_tag }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Read Version from gradle.properties + id: get_version # 给予此步骤一个 ID + run: | + VERSION=$(grep 'kitVersion=' gradle.properties | cut -d'=' -f2) + if [ -z "$VERSION" ]; then + echo "::error::kitVersion not found in gradle.properties" + exit 1 + fi + echo "Found version: $VERSION" + echo "version_tag=v${VERSION}" >> $GITHUB_OUTPUT + + # ----------------------------------------------------------------- + # 作业 2:构建、重命名并上传所有平台的产物 # ----------------------------------------------------------------- build-and-rename: strategy: matrix: include: - # Windows - os: windows-latest name: windows-x64 - os: windows-11-arm name: windows-arm64 - # Linux - os: ubuntu-latest name: linux-amd64 rpm_arch: linux-x86_64 - os: ubuntu-24.04-arm name: linux-arm64 rpm_arch: linux-aarch64 - # macOS - os: macos-15-intel name: macos-x64 - - os: macos-latest # Apple Silicon + - os: macos-latest name: macos-arm64 runs-on: ${{ matrix.os }} name: Build for ${{ matrix.name }} + needs: get-version steps: - name: Checkout uses: actions/checkout@v4 + # ... (你所有的构建和重命名步骤保持不变) ... + - name: Package Release Distribution run: ./gradlew packageReleaseDistributionForCurrentOS - name: Rename Windows Files if: runner.os == 'Windows' + # ... (pwsh script) ... shell: pwsh run: | $basePath = "${{ github.workspace }}\composeApp\output\main-release" $suffix = "${{ matrix.name }}" - Write-Host "🔍 Searching for MSI and EXE files in $basePath for $suffix..." - - $msi = Get-ChildItem -Path "$basePath\msi" -Filter "*.msi" -File -ErrorAction SilentlyContinue | Select-Object -First 1 - if ($null -ne $msi) { - $msiDest = "$basePath\msi\AndroidToolKit-$suffix.msi" - Write-Host "Renaming $($msi.FullName) -> $msiDest" - Move-Item -Path $msi.FullName -Destination $msiDest -Force - } else { - Write-Warning "⚠️ No .msi file found" - } - - $exe = Get-ChildItem -Path "$basePath\exe" -Filter "*.exe" -File -ErrorAction SilentlyContinue | Select-Object -First 1 - if ($null -ne $exe) { - $exeDest = "$basePath\exe\AndroidToolKit-$suffix.exe" - Write-Host "Renaming $($exe.FullName) -> $exeDest" - Move-Item -Path $exe.FullName -Destination $exeDest -Force - } else { - Write-Warning "⚠️ No .exe file found" - } - Write-Host "✅ Rename complete for $suffix." + # ... (rest of the script) ... - name: Rename Linux Files if: runner.os == 'Linux' + # ... (bash script) ... run: | set -e BASE_PATH="${{ github.workspace }}/composeApp/output/main-release" - echo "🔍 Searching for DEB and RPM files for ${{ matrix.name }}..." - - DEB_SRC=$(find "$BASE_PATH/deb" -type f -name "*.deb" | head -n 1 || true) - if [ -n "$DEB_SRC" ]; then - DEB_DEST="$BASE_PATH/deb/AndroidToolKit-${{ matrix.name }}.deb" - echo "Renaming: $DEB_SRC -> $DEB_DEST" - mv "$DEB_SRC" "$DEB_DEST" - else - echo "⚠️ No .deb file found" - fi - - RPM_SRC=$(find "$BASE_PATH/rpm" -type f -name "*.rpm" | head -n 1 || true) - if [ -n "$RPM_SRC" ]; then - RPM_DEST="$BASE_PATH/rpm/AndroidToolKit-${{ matrix.rpm_arch }}.rpm" # 注意这里用了专门的 rpm_arch - echo "Renaming: $RPM_SRC -> $RPM_DEST" - mv "$RPM_SRC" "$RPM_DEST" - else - echo "⚠️ No .rpm file found" - fi - echo "✅ Rename complete for ${{ matrix.name }}." + # ... (rest of the script) ... - name: Rename macOS File if: runner.os == 'macOS' + # ... (bash script) ... run: | set -e BASE_PATH="${{ github.workspace }}/composeApp/output/main-release" - echo "🔍 Searching for macOS build artifacts for ${{ matrix.name }}..." - - DMG_SRC=$(find "$BASE_PATH/dmg" -type f -name "*.dmg" | head -n 1 || true) - if [ -n "$DMG_SRC" ]; then - DMG_DEST="$BASE_PATH/dmg/AndroidToolKit-${{ matrix.name }}.dmg" - echo "Renaming: $DMG_SRC -> $DMG_DEST" - mv "$DMG_SRC" "$DMG_DEST" - else - echo "⚠️ No .dmg file found" - fi - echo "✅ Rename complete for ${{ matrix.name }}." + # ... (rest of the script) ... - # --- 上传产物(为 Job 2 准备)--- - name: Upload Artifact uses: actions/upload-artifact@v4 with: - name: release-assets-${{ matrix.name }} # 每个 job 的产物包名唯一 - path: | # 使用通配符匹配所有重命名后的文件 + name: release-assets-${{ matrix.name }} + path: | ${{ github.workspace }}/composeApp/output/main-release/msi/*.msi ${{ github.workspace }}/composeApp/output/main-release/exe/*.exe ${{ github.workspace }}/composeApp/output/main-release/deb/*.deb ${{ github.workspace }}/composeApp/output/main-release/rpm/*.rpm ${{ github.workspace }}/composeApp/output/main-release/dmg/*.dmg - if-no-files-found: warn # 如果某个平台没有产物(例如 Linux 没有 .msi)也不要报错 - retention-days: 1 # 只需要保留1天,Job 2 用完就丢 + if-no-files-found: warn + retention-days: 1 # ----------------------------------------------------------------- - # 作业 2:收集所有产物并创建(或更新)一个 Release + # 作业 3:收集所有产物并创建(或更新)一个 Release # ----------------------------------------------------------------- publish-release: name: Publish Draft Release runs-on: ubuntu-latest - needs: build-and-rename # 关键:等待所有 build-and-rename 任务成功 + needs: [get-version, build-and-rename] steps: + # --- 不再需要 Checkout 和 Read Version --- + - name: Download all artifacts uses: actions/download-artifact@v4 with: - path: release-assets # 下载到这个目录 - pattern: release-assets-* # 匹配所有 job 上传的产物 - merge-multiple: true # 关键:将所有产物包合并到 release-assets 目录下 + path: release-assets + pattern: release-assets-* + merge-multiple: true - name: List downloaded files (for debugging) run: | @@ -153,6 +130,7 @@ jobs: with: draft: true allowUpdates: true - tag: "v${{ inputs.tag_version }}" - artifacts: "release-assets/*/*" # 上传下载目录中的所有文件 + # --- 关键修改:从 needs.get-version 上下文获取 tag --- + tag: ${{ needs.get-version.outputs.version_tag }} + artifacts: "release-assets/*/*" # <--- 修正后的通配符 token: ${{ secrets.GH_TOKEN }} \ No newline at end of file From b9ecd5f3a3d616768214aba3f800a52616d14b62 Mon Sep 17 00:00:00 2001 From: LazyIonEs Date: Thu, 13 Nov 2025 13:05:34 +0800 Subject: [PATCH 08/10] =?UTF-8?q?refactor(ci):=20=E4=BC=98=E5=8C=96=20rele?= =?UTF-8?q?ase=20=E5=B7=A5=E4=BD=9C=E6=B5=81=20-=20=E6=B8=85=E7=90=86?= =?UTF-8?q?=E4=B8=8D=E5=BF=85=E8=A6=81=E7=9A=84=E6=B3=A8=E9=87=8A=E5=92=8C?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=EF=BC=8C=E7=AE=80=E5=8C=96=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-release.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 705c384..bdb46e2 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -19,7 +19,7 @@ jobs: uses: actions/checkout@v4 - name: Read Version from gradle.properties - id: get_version # 给予此步骤一个 ID + id: get_version run: | VERSION=$(grep 'kitVersion=' gradle.properties | cut -d'=' -f2) if [ -z "$VERSION" ]; then @@ -111,8 +111,6 @@ jobs: needs: [get-version, build-and-rename] steps: - # --- 不再需要 Checkout 和 Read Version --- - - name: Download all artifacts uses: actions/download-artifact@v4 with: @@ -132,5 +130,5 @@ jobs: allowUpdates: true # --- 关键修改:从 needs.get-version 上下文获取 tag --- tag: ${{ needs.get-version.outputs.version_tag }} - artifacts: "release-assets/*/*" # <--- 修正后的通配符 + artifacts: "release-assets/*/*" token: ${{ secrets.GH_TOKEN }} \ No newline at end of file From 3c5f3c6bf3a5fcff361b96bb7f64236bc3f117f2 Mon Sep 17 00:00:00 2001 From: LazyIonEs Date: Thu, 13 Nov 2025 19:36:09 +0800 Subject: [PATCH 09/10] =?UTF-8?q?refactor(ci):=20=E4=BC=98=E5=8C=96=20JDK?= =?UTF-8?q?=20=E8=AE=BE=E7=BD=AE=E4=B8=8E=E9=A1=B9=E7=9B=AE=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 `build-release.yml` 工作流中,根据 `runner.arch`(X64 或 ARM64)为不同架构分别设置对应的 Zulu JDK 21,取代了原先单一的 JDK 配置。 - 移除根 `build.gradle.kts` 文件中为所有子项目统一配置 Java 17 的 `subprojects` 块,以简化项目配置。 --- .github/workflows/build-release.yml | 19 ++++++++++++++++++- build.gradle.kts | 9 --------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index bdb46e2..b7d29f0 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -59,8 +59,25 @@ jobs: - name: Checkout uses: actions/checkout@v4 - # ... (你所有的构建和重命名步骤保持不变) ... + - name: Setup JDK (x64) + if: runner.arch == 'X64' + uses: actions/setup-java@v4 + with: + distribution: "zulu" + java-version: "21" + architecture: x64 + cache: 'gradle' + + - name: Setup JDK (ARM64) + if: runner.arch == 'ARM64' + uses: actions/setup-java@v4 + with: + distribution: "zulu" + java-version: "21" + architecture: aarch64 + cache: 'gradle' + # ... (你所有的构建和重命名步骤保持不变) ... - name: Package Release Distribution run: ./gradlew packageReleaseDistributionForCurrentOS diff --git a/build.gradle.kts b/build.gradle.kts index 086e845..b6a4032 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,15 +10,6 @@ plugins { alias(libs.plugins.hot.reload) apply false } -// Configure all subprojects -subprojects { - // Ensure consistent Java version across all modules - tasks.withType().configureEach { - sourceCompatibility = JavaVersion.VERSION_17.toString() - targetCompatibility = JavaVersion.VERSION_17.toString() - } -} - // Root project tasks tasks.register("clean", Delete::class) { delete(rootProject.layout.buildDirectory) From 2b4312e5c88d657acc1bce175a5d9f2c01df9f9f Mon Sep 17 00:00:00 2001 From: LazyIonEs Date: Thu, 13 Nov 2025 20:08:19 +0800 Subject: [PATCH 10/10] =?UTF-8?q?refactor(ci):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-release.yml | 69 ++++++++++++++----- .../kotlin/org/tool/kit/model/Model.kt | 6 +- .../tool/kit/utils/AndroidJunkGenerator.kt | 2 +- 3 files changed, 55 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index b7d29f0..201846e 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -4,14 +4,10 @@ on: workflow_dispatch: jobs: - # ----------------------------------------------------------------- - # 作业 1:获取版本号 - # ----------------------------------------------------------------- get-version: name: Get Version runs-on: ubuntu-latest outputs: - # 将版本号定义为作业输出 version_tag: ${{ steps.get_version.outputs.version_tag }} steps: @@ -29,9 +25,6 @@ jobs: echo "Found version: $VERSION" echo "version_tag=v${VERSION}" >> $GITHUB_OUTPUT - # ----------------------------------------------------------------- - # 作业 2:构建、重命名并上传所有平台的产物 - # ----------------------------------------------------------------- build-and-rename: strategy: matrix: @@ -77,34 +70,78 @@ jobs: architecture: aarch64 cache: 'gradle' - # ... (你所有的构建和重命名步骤保持不变) ... - name: Package Release Distribution run: ./gradlew packageReleaseDistributionForCurrentOS - name: Rename Windows Files if: runner.os == 'Windows' - # ... (pwsh script) ... shell: pwsh run: | $basePath = "${{ github.workspace }}\composeApp\output\main-release" $suffix = "${{ matrix.name }}" - # ... (rest of the script) ... + Write-Host "🔍 Searching for MSI and EXE files in $basePath for $suffix..." + + $msi = Get-ChildItem -Path "$basePath\msi" -Filter "*.msi" -File -ErrorAction SilentlyContinue | Select-Object -First 1 + if ($null -ne $msi) { + $msiDest = "$basePath\msi\AndroidToolKit-$suffix.msi" + Write-Host "Renaming $($msi.FullName) -> $msiDest" + Move-Item -Path $msi.FullName -Destination $msiDest -Force + } else { + Write-Warning "⚠️ No .msi file found" + } + + $exe = Get-ChildItem -Path "$basePath\exe" -Filter "*.exe" -File -ErrorAction SilentlyContinue | Select-Object -First 1 + if ($null -ne $exe) { + $exeDest = "$basePath\exe\AndroidToolKit-$suffix.exe" + Write-Host "Renaming $($exe.FullName) -> $exeDest" + Move-Item -Path $exe.FullName -Destination $exeDest -Force + } else { + Write-Warning "⚠️ No .exe file found" + } + Write-Host "✅ Rename complete for $suffix." - name: Rename Linux Files if: runner.os == 'Linux' - # ... (bash script) ... run: | set -e BASE_PATH="${{ github.workspace }}/composeApp/output/main-release" - # ... (rest of the script) ... + echo "🔍 Searching for DEB and RPM files for ${{ matrix.name }}..." + + DEB_SRC=$(find "$BASE_PATH/deb" -type f -name "*.deb" | head -n 1 || true) + if [ -n "$DEB_SRC" ]; then + DEB_DEST="$BASE_PATH/deb/AndroidToolKit-${{ matrix.name }}.deb" + echo "Renaming: $DEB_SRC -> $DEB_DEST" + mv "$DEB_SRC" "$DEB_DEST" + else + echo "⚠️ No .deb file found" + fi + + RPM_SRC=$(find "$BASE_PATH/rpm" -type f -name "*.rpm" | head -n 1 || true) + if [ -n "$RPM_SRC" ]; then + RPM_DEST="$BASE_PATH/rpm/AndroidToolKit-${{ matrix.rpm_arch }}.rpm" # 注意这里用了专门的 rpm_arch + echo "Renaming: $RPM_SRC -> $RPM_DEST" + mv "$RPM_SRC" "$RPM_DEST" + else + echo "⚠️ No .rpm file found" + fi + echo "✅ Rename complete for ${{ matrix.name }}." - name: Rename macOS File if: runner.os == 'macOS' - # ... (bash script) ... run: | set -e BASE_PATH="${{ github.workspace }}/composeApp/output/main-release" - # ... (rest of the script) ... + echo "🔍 Searching for macOS build artifacts for ${{ matrix.name }}..." + + DMG_SRC=$(find "$BASE_PATH/dmg" -type f -name "*.dmg" | head -n 1 || true) + if [ -n "$DMG_SRC" ]; then + DMG_DEST="$BASE_PATH/dmg/AndroidToolKit-${{ matrix.name }}.dmg" + echo "Renaming: $DMG_SRC -> $DMG_DEST" + mv "$DMG_SRC" "$DMG_DEST" + else + echo "⚠️ No .dmg file found" + fi + echo "✅ Rename complete for ${{ matrix.name }}." - name: Upload Artifact uses: actions/upload-artifact@v4 @@ -119,9 +156,6 @@ jobs: if-no-files-found: warn retention-days: 1 - # ----------------------------------------------------------------- - # 作业 3:收集所有产物并创建(或更新)一个 Release - # ----------------------------------------------------------------- publish-release: name: Publish Draft Release runs-on: ubuntu-latest @@ -145,7 +179,6 @@ jobs: with: draft: true allowUpdates: true - # --- 关键修改:从 needs.get-version 上下文获取 tag --- tag: ${{ needs.get-version.outputs.version_tag }} artifacts: "release-assets/*/*" token: ${{ secrets.GH_TOKEN }} \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/org/tool/kit/model/Model.kt b/shared/src/commonMain/kotlin/org/tool/kit/model/Model.kt index 56c6aaf..ecc4051 100644 --- a/shared/src/commonMain/kotlin/org/tool/kit/model/Model.kt +++ b/shared/src/commonMain/kotlin/org/tool/kit/model/Model.kt @@ -132,7 +132,7 @@ data class KeyStoreInfo( */ data class JunkCodeInfo( var outputPath: String = "", // 输出路径 - var aarName: String = "junk_com_dev_junk_plugin_TT2.0.0.aar", // aar名称 + var aarName: String = "junk_com_dev_junk_plugin_TT2.1.0.aar", // aar名称 private var _packageName: String = "com.dev.junk", // 包名 private var _suffix: String = "plugin", // 后缀 var packageCount: String = "50", // 包数量 @@ -143,14 +143,14 @@ data class JunkCodeInfo( get() = _packageName set(value) { _packageName = value - aarName = "junk_" + packageName.replace(".", "_") + "_" + this.suffix + "_TT2.0.0.aar" + aarName = "junk_" + packageName.replace(".", "_") + "_" + this.suffix + "_TT2.1.0.aar" } var suffix: String get() = _suffix set(value) { _suffix = value - aarName = "junk_" + packageName.replace(".", "_") + "_" + this.suffix + "_TT2.0.0.aar" + aarName = "junk_" + packageName.replace(".", "_") + "_" + this.suffix + "_TT2.1.0.aar" } } diff --git a/shared/src/commonMain/kotlin/org/tool/kit/utils/AndroidJunkGenerator.kt b/shared/src/commonMain/kotlin/org/tool/kit/utils/AndroidJunkGenerator.kt index 850e2f9..3810293 100644 --- a/shared/src/commonMain/kotlin/org/tool/kit/utils/AndroidJunkGenerator.kt +++ b/shared/src/commonMain/kotlin/org/tool/kit/utils/AndroidJunkGenerator.kt @@ -890,7 +890,7 @@ class AndroidJunkGenerator( // dir.deleteRecursively() // 打包aar - val out = File(output, "junk_" + appPackageName.replace(".", "_") + "_TT2.0.0.aar") + val out = File(output, "junk_" + appPackageName.replace(".", "_") + "_TT2.1.0.aar") val parent = out.parentFile if (!parent.exists()) { parent.mkdirs()