Compare commits
4 Commits
tauri-migr
...
v3.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49d8787ab9 | ||
|
|
a05fefb54c | ||
|
|
3574fa07cb | ||
|
|
b64b86f3ca |
158
.github/workflows/release.yml
vendored
158
.github/workflows/release.yml
vendored
@@ -30,6 +30,38 @@ jobs:
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Add macOS targets
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
rustup target add aarch64-apple-darwin x86_64-apple-darwin
|
||||
|
||||
- name: Install Linux system deps
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
sudo apt-get update
|
||||
# Core build tools and pkg-config
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
pkg-config \
|
||||
curl \
|
||||
wget \
|
||||
file \
|
||||
patchelf \
|
||||
libssl-dev
|
||||
# GTK/GLib stack for gdk-3.0, glib-2.0, gio-2.0
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
libgtk-3-dev \
|
||||
librsvg2-dev \
|
||||
libayatana-appindicator3-dev
|
||||
# WebKit2GTK (version differs across Ubuntu images; try 4.1 then 4.0)
|
||||
sudo apt-get install -y --no-install-recommends libwebkit2gtk-4.1-dev \
|
||||
|| sudo apt-get install -y --no-install-recommends libwebkit2gtk-4.0-dev
|
||||
# libsoup also changed major version; prefer 3.0 with fallback to 2.4
|
||||
sudo apt-get install -y --no-install-recommends libsoup-3.0-dev \
|
||||
|| sudo apt-get install -y --no-install-recommends libsoup2.4-dev
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
@@ -51,24 +83,124 @@ jobs:
|
||||
- name: Install frontend deps
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build and Release (Tauri)
|
||||
uses: tauri-apps/tauri-action@v0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build Tauri App (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: pnpm tauri build --target universal-apple-darwin
|
||||
|
||||
- name: Build Tauri App (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: pnpm tauri build
|
||||
|
||||
- name: Build Tauri App (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
run: pnpm tauri build
|
||||
|
||||
- name: Prepare macOS Assets
|
||||
if: runner.os == 'macOS'
|
||||
shell: bash
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
mkdir -p release-assets
|
||||
echo "Looking for .app bundle..."
|
||||
APP_PATH=""
|
||||
for path in \
|
||||
"src-tauri/target/release/bundle/macos" \
|
||||
"src-tauri/target/universal-apple-darwin/release/bundle/macos" \
|
||||
"src-tauri/target/aarch64-apple-darwin/release/bundle/macos" \
|
||||
"src-tauri/target/x86_64-apple-darwin/release/bundle/macos"; do
|
||||
if [ -d "$path" ]; then
|
||||
APP_PATH=$(find "$path" -name "*.app" -type d | head -1)
|
||||
[ -n "$APP_PATH" ] && break
|
||||
fi
|
||||
done
|
||||
if [ -z "$APP_PATH" ]; then
|
||||
echo "No .app found" >&2
|
||||
exit 1
|
||||
fi
|
||||
APP_DIR=$(dirname "$APP_PATH")
|
||||
APP_NAME=$(basename "$APP_PATH")
|
||||
cd "$APP_DIR"
|
||||
# 使用 ditto 打包更兼容资源分叉
|
||||
ditto -c -k --sequesterRsrc --keepParent "$APP_NAME" "CC-Switch-macOS.zip"
|
||||
mv "CC-Switch-macOS.zip" "$GITHUB_WORKSPACE/release-assets/"
|
||||
echo "macOS zip ready"
|
||||
|
||||
- name: Prepare Windows Assets
|
||||
if: runner.os == 'Windows'
|
||||
shell: pwsh
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
New-Item -ItemType Directory -Force -Path release-assets | Out-Null
|
||||
# 安装器(优先 NSIS,其次 MSI)
|
||||
$installer = Get-ChildItem -Path 'src-tauri/target/release/bundle' -Recurse -Include *.exe,*.msi -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.FullName -match '\\bundle\\(nsis|msi)\\' } |
|
||||
Select-Object -First 1
|
||||
if ($null -ne $installer) {
|
||||
$dest = if ($installer.Extension -ieq '.msi') { 'CC-Switch-Setup.msi' } else { 'CC-Switch-Setup.exe' }
|
||||
Copy-Item $installer.FullName (Join-Path release-assets $dest)
|
||||
Write-Host "Installer copied: $dest"
|
||||
} else {
|
||||
Write-Warning 'No Windows installer found'
|
||||
}
|
||||
# 绿色版(portable):仅可执行文件
|
||||
$exeCandidates = @(
|
||||
'src-tauri/target/release/cc-switch.exe',
|
||||
'src-tauri/target/x86_64-pc-windows-msvc/release/cc-switch.exe'
|
||||
)
|
||||
$exePath = $exeCandidates | Where-Object { Test-Path $_ } | Select-Object -First 1
|
||||
if ($null -ne $exePath) {
|
||||
$portableDir = 'release-assets/CC-Switch-Portable'
|
||||
New-Item -ItemType Directory -Force -Path $portableDir | Out-Null
|
||||
Copy-Item $exePath $portableDir
|
||||
Compress-Archive -Path "$portableDir/*" -DestinationPath 'release-assets/CC-Switch-Windows-Portable.zip' -Force
|
||||
Remove-Item -Recurse -Force $portableDir
|
||||
Write-Host 'Windows portable zip created'
|
||||
} else {
|
||||
Write-Warning 'Portable exe not found'
|
||||
}
|
||||
|
||||
- name: Prepare Linux Assets
|
||||
if: runner.os == 'Linux'
|
||||
shell: bash
|
||||
run: |
|
||||
set -euxo pipefail
|
||||
mkdir -p release-assets
|
||||
# 仅上传安装包(deb)
|
||||
DEB=$(find src-tauri/target/release/bundle -name "*.deb" | head -1 || true)
|
||||
if [ -n "$DEB" ]; then
|
||||
cp "$DEB" release-assets/
|
||||
echo "Deb package copied"
|
||||
else
|
||||
echo "No .deb found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: List prepared assets
|
||||
shell: bash
|
||||
run: |
|
||||
ls -la release-assets || true
|
||||
|
||||
- name: Upload Release Assets
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tagName: ${{ github.ref_name }}
|
||||
releaseName: CC Switch ${{ github.ref_name }}
|
||||
releaseBody: |
|
||||
tag_name: ${{ github.ref_name }}
|
||||
name: CC Switch ${{ github.ref_name }}
|
||||
body: |
|
||||
## CC Switch ${{ github.ref_name }}
|
||||
|
||||
Claude Code 供应商切换工具(Tauri 构建)
|
||||
Claude Code 供应商切换工具
|
||||
|
||||
- Windows: .msi / NSIS 安装包
|
||||
- macOS: .dmg / .app 压缩包
|
||||
- Linux: AppImage / deb / rpm
|
||||
### 下载
|
||||
|
||||
如遇未知开发者提示,请在系统隐私与安全设置中选择“仍要打开”。
|
||||
tauriScript: pnpm tauri
|
||||
- macOS: `CC-Switch-macOS.zip`(解压即用)
|
||||
- Windows: `CC-Switch-Setup.exe` 或 `CC-Switch-Setup.msi`(安装版);`CC-Switch-Windows-Portable.zip`(绿色版)
|
||||
- Linux: `*.deb`(Debian/Ubuntu 安装包)
|
||||
|
||||
---
|
||||
提示:macOS 如遇“已损坏”提示,可在终端执行:`xattr -cr "/Applications/CC Switch.app"`
|
||||
files: release-assets/*
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: List generated bundles (debug)
|
||||
if: always()
|
||||
|
||||
10
README.md
10
README.md
@@ -42,7 +42,15 @@
|
||||
|
||||
### macOS 用户
|
||||
|
||||
从 [Releases](../../releases) 页面下载最新版本的 `CC-Switch_3.0.0_x64.dmg` (Intel) 或 `CC-Switch_3.0.0_aarch64.dmg` (Apple Silicon)。
|
||||
从 [Releases](../../releases) 页面下载最新版本:
|
||||
|
||||
- **推荐**: `CC-Switch.zip` - 解压即用,无需安装
|
||||
- `CC-Switch_3.0.0_aarch64.dmg` (Apple Silicon) - 需要安装
|
||||
|
||||
> **注意**:由于应用未签名,macOS 可能提示"已损坏"。解决方法:
|
||||
> 1. **推荐**:下载 zip 版本,解压后直接使用
|
||||
> 2. 或在终端运行:`xattr -cr "/Applications/CC Switch.app"`
|
||||
> 3. 或在"系统设置 > 隐私与安全"中选择"仍要打开"
|
||||
|
||||
### Linux 用户
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": ["app", "dmg", "nsis", "appimage"],
|
||||
"targets": "all",
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
|
||||
Reference in New Issue
Block a user