feat: optimize release workflow for better distribution
- Configure GitHub Actions to generate platform-specific releases: - macOS: zip package only (avoids signing issues) - Windows: installer (NSIS) and portable version - Linux: AppImage and deb packages - Update Tauri config to build all available targets - Add documentation for macOS signature workarounds
This commit is contained in:
106
.github/workflows/release.yml
vendored
106
.github/workflows/release.yml
vendored
@@ -78,24 +78,104 @@ jobs:
|
|||||||
- name: Install frontend deps
|
- name: Install frontend deps
|
||||||
run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Build and Release (Tauri)
|
- name: Build Tauri App
|
||||||
uses: tauri-apps/tauri-action@v0
|
shell: bash
|
||||||
env:
|
run: |
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
if [ "${{ runner.os }}" == "macOS" ]; then
|
||||||
|
# macOS: 只构建 app bundle (用于创建 zip)
|
||||||
|
pnpm tauri build --target aarch64-apple-darwin
|
||||||
|
elif [ "${{ runner.os }}" == "Windows" ]; then
|
||||||
|
# Windows: 构建 NSIS 安装器
|
||||||
|
pnpm tauri build --target x86_64-pc-windows-msvc
|
||||||
|
else
|
||||||
|
# Linux: 构建 AppImage 和 deb
|
||||||
|
pnpm tauri build
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Prepare Release Assets
|
||||||
|
id: prepare
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
mkdir -p release-assets
|
||||||
|
|
||||||
|
if [ "${{ runner.os }}" == "macOS" ]; then
|
||||||
|
# macOS: 创建 zip 包
|
||||||
|
APP_PATH=$(find src-tauri/target/release/bundle/macos -name "*.app" -type d | head -1)
|
||||||
|
if [ -n "$APP_PATH" ]; then
|
||||||
|
APP_NAME=$(basename "$APP_PATH")
|
||||||
|
cd "$(dirname "$APP_PATH")"
|
||||||
|
zip -r "CC-Switch-macOS.zip" "$APP_NAME"
|
||||||
|
mv "CC-Switch-macOS.zip" "$GITHUB_WORKSPACE/release-assets/"
|
||||||
|
echo "Created macOS zip"
|
||||||
|
fi
|
||||||
|
|
||||||
|
elif [ "${{ runner.os }}" == "Windows" ]; then
|
||||||
|
# Windows: 复制 NSIS 安装器
|
||||||
|
NSIS_PATH=$(find src-tauri/target/release/bundle/nsis -name "*.exe" | head -1)
|
||||||
|
if [ -n "$NSIS_PATH" ]; then
|
||||||
|
cp "$NSIS_PATH" "release-assets/CC-Switch-Setup.exe"
|
||||||
|
echo "Copied Windows installer"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Windows: 创建绿色版 (portable)
|
||||||
|
EXE_PATH="src-tauri/target/release/cc-switch.exe"
|
||||||
|
if [ -f "$EXE_PATH" ]; then
|
||||||
|
mkdir -p "release-assets/CC-Switch-Portable"
|
||||||
|
cp "$EXE_PATH" "release-assets/CC-Switch-Portable/"
|
||||||
|
cd release-assets
|
||||||
|
zip -r "CC-Switch-Windows-Portable.zip" "CC-Switch-Portable"
|
||||||
|
rm -rf "CC-Switch-Portable"
|
||||||
|
cd ..
|
||||||
|
echo "Created Windows portable version"
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
# Linux: 复制 AppImage 和 deb
|
||||||
|
APPIMAGE=$(find src-tauri/target/release/bundle -name "*.AppImage" | head -1)
|
||||||
|
DEB=$(find src-tauri/target/release/bundle -name "*.deb" | head -1)
|
||||||
|
|
||||||
|
if [ -n "$APPIMAGE" ]; then
|
||||||
|
cp "$APPIMAGE" "release-assets/CC-Switch.AppImage"
|
||||||
|
echo "Copied AppImage"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$DEB" ]; then
|
||||||
|
cp "$DEB" "release-assets/"
|
||||||
|
echo "Copied deb package"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
ls -la release-assets/
|
||||||
|
|
||||||
|
- name: Upload Release Assets
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
with:
|
with:
|
||||||
tagName: ${{ github.ref_name }}
|
tag_name: ${{ github.ref_name }}
|
||||||
releaseName: CC Switch ${{ github.ref_name }}
|
name: CC Switch ${{ github.ref_name }}
|
||||||
releaseBody: |
|
body: |
|
||||||
## CC Switch ${{ github.ref_name }}
|
## CC Switch ${{ github.ref_name }}
|
||||||
|
|
||||||
Claude Code 供应商切换工具(Tauri 构建)
|
Claude Code 供应商切换工具
|
||||||
|
|
||||||
- Windows: .msi / NSIS 安装包
|
### 下载说明
|
||||||
- macOS: .dmg / .app 压缩包
|
|
||||||
- Linux: AppImage / deb / rpm
|
|
||||||
|
|
||||||
如遇未知开发者提示,请在系统隐私与安全设置中选择“仍要打开”。
|
#### macOS
|
||||||
tauriScript: pnpm tauri
|
- `CC-Switch-macOS.zip` - 解压即用(推荐)
|
||||||
|
|
||||||
|
#### Windows
|
||||||
|
- `CC-Switch-Setup.exe` - 安装版
|
||||||
|
- `CC-Switch-Windows-Portable.zip` - 绿色版,解压即用
|
||||||
|
|
||||||
|
#### Linux
|
||||||
|
- `CC-Switch.AppImage` - AppImage 格式
|
||||||
|
- `*.deb` - Debian/Ubuntu 安装包
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**macOS 签名问题**:如遇"已损坏"提示,请在终端运行 `xattr -cr "/Applications/CC Switch.app"`
|
||||||
|
files: release-assets/*
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: List generated bundles (debug)
|
- name: List generated bundles (debug)
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
10
README.md
10
README.md
@@ -42,7 +42,15 @@
|
|||||||
|
|
||||||
### macOS 用户
|
### 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 用户
|
### Linux 用户
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
},
|
},
|
||||||
"bundle": {
|
"bundle": {
|
||||||
"active": true,
|
"active": true,
|
||||||
"targets": ["app", "dmg", "nsis", "appimage"],
|
"targets": "all",
|
||||||
"icon": [
|
"icon": [
|
||||||
"icons/32x32.png",
|
"icons/32x32.png",
|
||||||
"icons/128x128.png",
|
"icons/128x128.png",
|
||||||
|
|||||||
Reference in New Issue
Block a user