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
|
||||
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
|
||||
shell: bash
|
||||
run: |
|
||||
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:
|
||||
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-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)
|
||||
if: always()
|
||||
|
||||
Reference in New Issue
Block a user