Skip to content

chore(release): v4.2.2 #15

chore(release): v4.2.2

chore(release): v4.2.2 #15

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
concurrency:
group: release-${{ github.ref_name }}
cancel-in-progress: true
jobs:
build:
name: Build ${{ matrix.platform }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# macOS ARM64
- os: macos-14
platform: darwin-arm64
target: aarch64-apple-darwin
binary: cc-switch
# macOS x86_64
- os: macos-14
platform: darwin-x64
target: x86_64-apple-darwin
binary: cc-switch
# Windows x86_64
- os: windows-2022
platform: windows-x64
target: x86_64-pc-windows-msvc
binary: cc-switch.exe
# Linux x86_64 - MUSL (recommended)
- os: ubuntu-22.04
platform: linux-x64-musl
target: x86_64-unknown-linux-musl
binary: cc-switch
use_cross: true
# Linux x86_64 - GLIBC (fallback)
- os: ubuntu-22.04
platform: linux-x64
target: x86_64-unknown-linux-gnu
binary: cc-switch
use_cross: false
# Linux ARM64 - MUSL (recommended)
- os: ubuntu-22.04
platform: linux-arm64-musl
target: aarch64-unknown-linux-musl
binary: cc-switch
use_cross: true
# Linux ARM64 - GLIBC (fallback)
- os: ubuntu-22.04
platform: linux-arm64
target: aarch64-unknown-linux-gnu
binary: cc-switch
use_cross: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri
key: ${{ matrix.target }}
- name: Install cross
if: matrix.use_cross == true
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Install Linux dependencies (GLIBC x64)
if: runner.os == 'Linux' && matrix.target == 'x86_64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
pkg-config \
libssl-dev
- name: Build with cross
if: matrix.use_cross == true
working-directory: src-tauri
run: cross build --release --target ${{ matrix.target }}
- name: Build with cargo
if: matrix.use_cross != true
working-directory: src-tauri
run: cargo build --release --target ${{ matrix.target }}
- name: Prepare binary
shell: bash
run: |
mkdir -p dist
cp src-tauri/target/${{ matrix.target }}/release/${{ matrix.binary }} dist/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: cc-switch-cli-${{ matrix.platform }}
path: dist/${{ matrix.binary }}
if-no-files-found: error
# Create macOS universal binary
universal-macos:
name: Universal macOS Binary
runs-on: macos-14
needs: build
steps:
- name: Download ARM64 binary
uses: actions/download-artifact@v4
with:
name: cc-switch-cli-darwin-arm64
path: arm64
- name: Download x64 binary
uses: actions/download-artifact@v4
with:
name: cc-switch-cli-darwin-x64
path: x64
- name: Create universal binary
run: |
mkdir -p universal
lipo -create -output universal/cc-switch arm64/cc-switch x64/cc-switch
chmod +x universal/cc-switch
file universal/cc-switch
- name: Upload universal artifact
uses: actions/upload-artifact@v4
with:
name: cc-switch-cli-darwin-universal
path: universal/cc-switch
if-no-files-found: error
release:
name: Create Release
runs-on: ubuntu-22.04
needs: [build, universal-macos]
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display structure
run: |
ls -R artifacts/
- name: Prepare release assets
run: |
set -euxo pipefail
mkdir -p release-assets
VERSION="${GITHUB_REF_NAME}"
# macOS Universal
if [ -f "artifacts/cc-switch-cli-darwin-universal/cc-switch" ]; then
tar -czf release-assets/cc-switch-cli-${VERSION}-darwin-universal.tar.gz \
-C artifacts/cc-switch-cli-darwin-universal cc-switch
fi
# macOS ARM64
if [ -f "artifacts/cc-switch-cli-darwin-arm64/cc-switch" ]; then
tar -czf release-assets/cc-switch-cli-${VERSION}-darwin-arm64.tar.gz \
-C artifacts/cc-switch-cli-darwin-arm64 cc-switch
fi
# macOS x64
if [ -f "artifacts/cc-switch-cli-darwin-x64/cc-switch" ]; then
tar -czf release-assets/cc-switch-cli-${VERSION}-darwin-x64.tar.gz \
-C artifacts/cc-switch-cli-darwin-x64 cc-switch
fi
# Windows
if [ -f "artifacts/cc-switch-cli-windows-x64/cc-switch.exe" ]; then
cd artifacts/cc-switch-cli-windows-x64
zip ../../release-assets/cc-switch-cli-${VERSION}-windows-x64.zip cc-switch.exe
cd ../..
fi
# Linux x64 - MUSL
if [ -f "artifacts/cc-switch-cli-linux-x64-musl/cc-switch" ]; then
tar -czf release-assets/cc-switch-cli-${VERSION}-linux-x64-musl.tar.gz \
-C artifacts/cc-switch-cli-linux-x64-musl cc-switch
fi
# Linux x64 - GLIBC
if [ -f "artifacts/cc-switch-cli-linux-x64/cc-switch" ]; then
tar -czf release-assets/cc-switch-cli-${VERSION}-linux-x64.tar.gz \
-C artifacts/cc-switch-cli-linux-x64 cc-switch
fi
# Linux ARM64 - MUSL
if [ -f "artifacts/cc-switch-cli-linux-arm64-musl/cc-switch" ]; then
tar -czf release-assets/cc-switch-cli-${VERSION}-linux-arm64-musl.tar.gz \
-C artifacts/cc-switch-cli-linux-arm64-musl cc-switch
fi
# Linux ARM64 - GLIBC
if [ -f "artifacts/cc-switch-cli-linux-arm64/cc-switch" ]; then
tar -czf release-assets/cc-switch-cli-${VERSION}-linux-arm64.tar.gz \
-C artifacts/cc-switch-cli-linux-arm64 cc-switch
fi
echo "=== Release assets ==="
ls -lh release-assets/
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: CC Switch CLI ${{ github.ref_name }}
draft: false
prerelease: false
body: |
## CC Switch CLI ${{ github.ref_name }}
All-in-One Assistant for Claude Code, Codex & Gemini CLI
### 📦 下载 / Downloads
| 平台 Platform | 文件 File |
|---------------|-----------|
| **macOS** (Universal) | `cc-switch-cli-${{ github.ref_name }}-darwin-universal.tar.gz` |
| **Windows** (x64) | `cc-switch-cli-${{ github.ref_name }}-windows-x64.zip` |
| **Linux** (x64 musl) | `cc-switch-cli-${{ github.ref_name }}-linux-x64-musl.tar.gz` |
| **Linux** (x64 glibc) | `cc-switch-cli-${{ github.ref_name }}-linux-x64.tar.gz` |
| **Linux** (ARM64 musl) | `cc-switch-cli-${{ github.ref_name }}-linux-arm64-musl.tar.gz` |
| **Linux** (ARM64 glibc) | `cc-switch-cli-${{ github.ref_name }}-linux-arm64.tar.gz` |
### 🚀 快速安装
**macOS / Linux:**
```bash
tar -xzf cc-switch-cli-*.tar.gz
chmod +x cc-switch
sudo mv cc-switch /usr/local/bin/
```
**Windows:**
```powershell
# 解压 zip 后将 cc-switch.exe 移动到 PATH 目录或直接运行
```
💡 **macOS 提示**: 如遇 "无法验证开发者",执行:`xattr -cr /usr/local/bin/cc-switch`
💡 **Linux 用户建议优先使用 `-musl` 版本(静态链接,无系统库依赖,兼容所有发行版)**
files: release-assets/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}