Skip to content

Commit 4abf259

Browse files
committed
feat(ci): add Linux ARM64 build support
- Add ubuntu-22.04-arm runner to build matrix - Rename Linux artifacts with architecture suffix (x86_64/arm64) - Update pnpm cache key with runner.arch to avoid cross-arch pollution - Add linux-aarch64 platform to latest.json for Tauri updater
1 parent faa82a5 commit 4abf259

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

.github/workflows/release.yml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
include:
2121
- os: windows-2022
2222
- os: ubuntu-22.04
23+
- os: ubuntu-22.04-arm
24+
arch: arm64
2325
- os: macos-14
2426

2527
steps:
@@ -85,8 +87,8 @@ jobs:
8587
uses: actions/cache@v4
8688
with:
8789
path: ${{ steps.pnpm-store.outputs.path }}
88-
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
89-
restore-keys: ${{ runner.os }}-pnpm-store-
90+
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
91+
restore-keys: ${{ runner.os }}-${{ runner.arch }}-pnpm-store-
9092

9193
- name: Install frontend deps
9294
run: pnpm install --frozen-lockfile
@@ -256,10 +258,11 @@ jobs:
256258
set -euxo pipefail
257259
mkdir -p release-assets
258260
VERSION="${GITHUB_REF_NAME}" # e.g., v3.5.0
261+
ARCH="${{ matrix.arch || 'x86_64' }}"
259262
# Updater artifact: AppImage(含对应 .sig)
260263
APPIMAGE=$(find src-tauri/target/release/bundle -name "*.AppImage" | head -1 || true)
261264
if [ -n "$APPIMAGE" ]; then
262-
NEW_APPIMAGE="CC-Switch-${VERSION}-Linux.AppImage"
265+
NEW_APPIMAGE="CC-Switch-${VERSION}-Linux-${ARCH}.AppImage"
263266
cp "$APPIMAGE" "release-assets/$NEW_APPIMAGE"
264267
[ -f "$APPIMAGE.sig" ] && cp "$APPIMAGE.sig" "release-assets/$NEW_APPIMAGE.sig" || echo ".sig for AppImage not found"
265268
echo "AppImage copied: $NEW_APPIMAGE"
@@ -269,18 +272,16 @@ jobs:
269272
# 额外上传 .deb(用于手动安装,不参与 Updater)
270273
DEB=$(find src-tauri/target/release/bundle -name "*.deb" | head -1 || true)
271274
if [ -n "$DEB" ]; then
272-
NEW_DEB="CC-Switch-${VERSION}-Linux.deb"
273-
cp "$DEB" "release-assets/$NEW_DEB"
274-
echo "Deb package copied: $NEW_DEB"
275+
cp "$DEB" "release-assets/CC-Switch-${VERSION}-Linux-${ARCH}.deb"
276+
echo "Deb package copied: CC-Switch-${VERSION}-Linux-${ARCH}.deb"
275277
else
276278
echo "No .deb found (optional)"
277279
fi
278280
# 额外上传 .rpm(用于 Fedora/RHEL/openSUSE 等,不参与 Updater)
279281
RPM=$(find src-tauri/target/release/bundle -name "*.rpm" | head -1 || true)
280282
if [ -n "$RPM" ]; then
281-
NEW_RPM="CC-Switch-${VERSION}-Linux.rpm"
282-
cp "$RPM" "release-assets/$NEW_RPM"
283-
echo "RPM package copied: $NEW_RPM"
283+
cp "$RPM" "release-assets/CC-Switch-${VERSION}-Linux-${ARCH}.rpm"
284+
echo "RPM package copied: CC-Switch-${VERSION}-Linux-${ARCH}.rpm"
284285
else
285286
echo "No .rpm found (optional)"
286287
fi
@@ -312,7 +313,8 @@ jobs:
312313
313314
- **macOS**: `CC-Switch-${{ github.ref_name }}-macOS.zip`(解压即用)或 `CC-Switch-${{ github.ref_name }}-macOS.tar.gz`(Homebrew)
314315
- **Windows**: `CC-Switch-${{ github.ref_name }}-Windows.msi`(安装版)或 `CC-Switch-${{ github.ref_name }}-Windows-Portable.zip`(绿色版)
315-
- **Linux**: `CC-Switch-${{ github.ref_name }}-Linux.AppImage`(AppImage)或 `CC-Switch-${{ github.ref_name }}-Linux.deb`(Debian/Ubuntu)或 `CC-Switch-${{ github.ref_name }}-Linux.rpm`(Fedora/RHEL/openSUSE)
316+
- **Linux (x86_64)**: `CC-Switch-${{ github.ref_name }}-Linux-x86_64.AppImage` / `.deb` / `.rpm`
317+
- **Linux (ARM64)**: `CC-Switch-${{ github.ref_name }}-Linux-arm64.AppImage` / `.deb` / `.rpm`
316318
317319
---
318320
提示:macOS 如遇"已损坏"提示,可在终端执行:`xattr -cr "/Applications/CC Switch.app"`
@@ -360,7 +362,8 @@ jobs:
360362
# 初始化空平台映射
361363
mac_url=""; mac_sig=""
362364
win_url=""; win_sig=""
363-
linux_url=""; linux_sig=""
365+
linux_x64_url=""; linux_x64_sig=""
366+
linux_arm64_url=""; linux_arm64_sig=""
364367
shopt -s nullglob
365368
for sig in dl/*.sig; do
366369
base=${sig%.sig}
@@ -371,8 +374,10 @@ jobs:
371374
*.tar.gz)
372375
# 视为 macOS updater artifact
373376
mac_url="$url"; mac_sig="$sig_content";;
374-
*.AppImage|*.appimage)
375-
linux_url="$url"; linux_sig="$sig_content";;
377+
*-Linux-arm64.AppImage|*-Linux-arm64.appimage)
378+
linux_arm64_url="$url"; linux_arm64_sig="$sig_content";;
379+
*-Linux-x86_64.AppImage|*-Linux-x86_64.appimage)
380+
linux_x64_url="$url"; linux_x64_sig="$sig_content";;
376381
*.msi|*.exe)
377382
win_url="$url"; win_sig="$sig_content";;
378383
esac
@@ -399,9 +404,14 @@ jobs:
399404
echo " \"windows-x86_64\": {\"signature\": \"$win_sig\", \"url\": \"$win_url\"}"
400405
first=0
401406
fi
402-
if [ -n "$linux_url" ] && [ -n "$linux_sig" ]; then
407+
if [ -n "$linux_x64_url" ] && [ -n "$linux_x64_sig" ]; then
403408
[ $first -eq 0 ] && echo ','
404-
echo " \"linux-x86_64\": {\"signature\": \"$linux_sig\", \"url\": \"$linux_url\"}"
409+
echo " \"linux-x86_64\": {\"signature\": \"$linux_x64_sig\", \"url\": \"$linux_x64_url\"}"
410+
first=0
411+
fi
412+
if [ -n "$linux_arm64_url" ] && [ -n "$linux_arm64_sig" ]; then
413+
[ $first -eq 0 ] && echo ','
414+
echo " \"linux-aarch64\": {\"signature\": \"$linux_arm64_sig\", \"url\": \"$linux_arm64_url\"}"
405415
first=0
406416
fi
407417
echo ' }'

0 commit comments

Comments
 (0)