mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-01-24 14:33:08 +08:00
feat(release): add RPM and Flatpak packaging support for Linux
- Add RPM bundle to Linux build targets in CI workflow - Add Flatpak manifest, desktop entry, and AppStream metainfo - Update release workflow to build and publish .rpm and .flatpak artifacts - Update README docs with new Linux package formats and installation instructions - Add .gitignore rules for Flatpak build artifacts
This commit is contained in:
31
.github/workflows/release.yml
vendored
31
.github/workflows/release.yml
vendored
@@ -53,7 +53,10 @@ jobs:
|
||||
wget \
|
||||
file \
|
||||
patchelf \
|
||||
libssl-dev
|
||||
libssl-dev \
|
||||
rpm \
|
||||
flatpak \
|
||||
flatpak-builder
|
||||
# GTK/GLib stack for gdk-3.0, glib-2.0, gio-2.0
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
libgtk-3-dev \
|
||||
@@ -153,7 +156,7 @@ jobs:
|
||||
|
||||
- name: Build Tauri App (Linux)
|
||||
if: runner.os == 'Linux'
|
||||
run: pnpm tauri build
|
||||
run: pnpm tauri build -- --bundles appimage,deb,rpm
|
||||
|
||||
- name: Prepare macOS Assets
|
||||
if: runner.os == 'macOS'
|
||||
@@ -271,6 +274,28 @@ jobs:
|
||||
else
|
||||
echo "No .deb found (optional)"
|
||||
fi
|
||||
# 额外上传 .rpm(用于 Fedora/RHEL/openSUSE 等,不参与 Updater)
|
||||
RPM=$(find src-tauri/target/release/bundle -name "*.rpm" | head -1 || true)
|
||||
if [ -n "$RPM" ]; then
|
||||
NEW_RPM="CC-Switch-${VERSION}-Linux.rpm"
|
||||
cp "$RPM" "release-assets/$NEW_RPM"
|
||||
echo "RPM package copied: $NEW_RPM"
|
||||
else
|
||||
echo "No .rpm found (optional)"
|
||||
fi
|
||||
# 额外上传 .flatpak(跨发行版;不参与 Updater)
|
||||
if [ -n "$DEB" ]; then
|
||||
echo "Building Flatpak bundle from .deb..."
|
||||
cp "$DEB" flatpak/cc-switch.deb
|
||||
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
flatpak install -y --user flathub org.gnome.Platform//46 org.gnome.Sdk//46
|
||||
flatpak-builder --force-clean --user --disable-cache --repo flatpak-repo flatpak-build flatpak/com.ccswitch.desktop.yml
|
||||
NEW_FLATPAK="CC-Switch-${VERSION}-Linux.flatpak"
|
||||
flatpak build-bundle --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo flatpak-repo "release-assets/$NEW_FLATPAK" com.ccswitch.desktop
|
||||
echo "Flatpak bundle created: $NEW_FLATPAK"
|
||||
else
|
||||
echo "Skip Flatpak build: no .deb found"
|
||||
fi
|
||||
|
||||
- name: List prepared assets
|
||||
shell: bash
|
||||
@@ -299,7 +324,7 @@ jobs:
|
||||
|
||||
- **macOS**: `CC-Switch-${{ github.ref_name }}-macOS.zip`(解压即用)或 `CC-Switch-${{ github.ref_name }}-macOS.tar.gz`(Homebrew)
|
||||
- **Windows**: `CC-Switch-${{ github.ref_name }}-Windows.msi`(安装版)或 `CC-Switch-${{ github.ref_name }}-Windows-Portable.zip`(绿色版)
|
||||
- **Linux**: `CC-Switch-${{ github.ref_name }}-Linux.AppImage`(AppImage)或 `CC-Switch-${{ github.ref_name }}-Linux.deb`(Debian/Ubuntu)
|
||||
- **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)或 `CC-Switch-${{ github.ref_name }}-Linux.flatpak`(Flatpak)
|
||||
|
||||
---
|
||||
提示:macOS 如遇"已损坏"提示,可在终端执行:`xattr -cr "/Applications/CC Switch.app"`
|
||||
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -18,3 +18,8 @@ GEMINI.md
|
||||
/.vscode
|
||||
vitest-report.json
|
||||
nul
|
||||
|
||||
# Flatpak build artifacts
|
||||
flatpak/cc-switch.deb
|
||||
flatpak-build/
|
||||
flatpak-repo/
|
||||
|
||||
14
README.md
14
README.md
@@ -186,7 +186,19 @@ paru -S cc-switch-bin
|
||||
|
||||
### Linux Users
|
||||
|
||||
Download the latest `CC-Switch-v{version}-Linux.deb` package or `CC-Switch-v{version}-Linux.AppImage` from the [Releases](../../releases) page.
|
||||
Download the latest Linux build from the [Releases](../../releases) page:
|
||||
|
||||
- `CC-Switch-v{version}-Linux.deb` (Debian/Ubuntu)
|
||||
- `CC-Switch-v{version}-Linux.rpm` (Fedora/RHEL/openSUSE)
|
||||
- `CC-Switch-v{version}-Linux.AppImage` (Universal)
|
||||
- `CC-Switch-v{version}-Linux.flatpak` (Flatpak)
|
||||
|
||||
Flatpak install & run:
|
||||
|
||||
```bash
|
||||
flatpak install --user ./CC-Switch-v{version}-Linux.flatpak
|
||||
flatpak run com.ccswitch.desktop
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
|
||||
14
README_JA.md
14
README_JA.md
@@ -186,7 +186,19 @@ paru -S cc-switch-bin
|
||||
|
||||
### Linux ユーザー
|
||||
|
||||
[Releases](../../releases) から最新版の `CC-Switch-v{version}-Linux.deb` または `CC-Switch-v{version}-Linux.AppImage` をダウンロード。
|
||||
[Releases](../../releases) から最新版の Linux ビルドをダウンロード:
|
||||
|
||||
- `CC-Switch-v{version}-Linux.deb`(Debian/Ubuntu)
|
||||
- `CC-Switch-v{version}-Linux.rpm`(Fedora/RHEL/openSUSE)
|
||||
- `CC-Switch-v{version}-Linux.AppImage`(汎用)
|
||||
- `CC-Switch-v{version}-Linux.flatpak`(Flatpak)
|
||||
|
||||
Flatpak のインストールと起動:
|
||||
|
||||
```bash
|
||||
flatpak install --user ./CC-Switch-v{version}-Linux.flatpak
|
||||
flatpak run com.ccswitch.desktop
|
||||
```
|
||||
|
||||
## クイックスタート
|
||||
|
||||
|
||||
14
README_ZH.md
14
README_ZH.md
@@ -186,7 +186,19 @@ paru -S cc-switch-bin
|
||||
|
||||
### Linux 用户
|
||||
|
||||
从 [Releases](../../releases) 页面下载最新版本的 `CC-Switch-v{版本号}-Linux.deb` 包或者 `CC-Switch-v{版本号}-Linux.AppImage` 安装包。
|
||||
从 [Releases](../../releases) 页面下载最新版本的 Linux 安装包:
|
||||
|
||||
- `CC-Switch-v{版本号}-Linux.deb`(Debian/Ubuntu)
|
||||
- `CC-Switch-v{版本号}-Linux.rpm`(Fedora/RHEL/openSUSE)
|
||||
- `CC-Switch-v{版本号}-Linux.AppImage`(通用)
|
||||
- `CC-Switch-v{版本号}-Linux.flatpak`(Flatpak)
|
||||
|
||||
Flatpak 安装与运行:
|
||||
|
||||
```bash
|
||||
flatpak install --user ./CC-Switch-v{版本号}-Linux.flatpak
|
||||
flatpak run com.ccswitch.desktop
|
||||
```
|
||||
|
||||
## 快速开始
|
||||
|
||||
|
||||
63
flatpak/README.md
Normal file
63
flatpak/README.md
Normal file
@@ -0,0 +1,63 @@
|
||||
# Flatpak Build Guide
|
||||
|
||||
This directory contains the Flatpak manifest (`com.ccswitch.desktop`) for CC Switch, used to convert the generated `.deb` artifact into an installable `.flatpak` package via CI or local builds.
|
||||
|
||||
## Dependencies
|
||||
|
||||
- `flatpak`
|
||||
- `flatpak-builder`
|
||||
- Flathub remote (for installing `org.gnome.Platform//46` runtime)
|
||||
|
||||
For Ubuntu/Debian:
|
||||
|
||||
```bash
|
||||
sudo apt install flatpak flatpak-builder
|
||||
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||
flatpak install -y --user flathub org.gnome.Platform//46 org.gnome.Sdk//46
|
||||
```
|
||||
|
||||
## Local Build (Generate .flatpak from .deb)
|
||||
|
||||
1) Build the deb on Linux first:
|
||||
|
||||
```bash
|
||||
pnpm tauri build -- --bundles deb
|
||||
```
|
||||
|
||||
2) Copy the generated deb to this directory:
|
||||
|
||||
```bash
|
||||
cp "$(find src-tauri/target/release/bundle -name '*.deb' | head -n 1)" flatpak/cc-switch.deb
|
||||
```
|
||||
|
||||
3) Build the local Flatpak repository and export the `.flatpak`:
|
||||
|
||||
```bash
|
||||
flatpak-builder --force-clean --user --disable-cache --repo flatpak-repo flatpak-build flatpak/com.ccswitch.desktop.yml
|
||||
flatpak build-bundle --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo flatpak-repo CC-Switch-Linux.flatpak com.ccswitch.desktop
|
||||
```
|
||||
|
||||
4) Install and run:
|
||||
|
||||
```bash
|
||||
flatpak install --user ./CC-Switch-Linux.flatpak
|
||||
flatpak run com.ccswitch.desktop
|
||||
```
|
||||
|
||||
## Permissions Note
|
||||
|
||||
The current manifest uses `--filesystem=home` by default for "download and run" convenience, allowing the app to directly read/write CLI configuration files and app data on the host (and supporting the "directory override" feature).
|
||||
|
||||
If you prefer minimal permissions (e.g., for Flathub submission or security concerns), you can replace `--filesystem=home` in `flatpak/com.ccswitch.desktop.yml` with more precise grants:
|
||||
|
||||
```yaml
|
||||
- --filesystem=~/.cc-switch:create
|
||||
- --filesystem=~/.claude:create
|
||||
- --filesystem=~/.claude.json
|
||||
- --filesystem=~/.codex:create
|
||||
- --filesystem=~/.gemini:create
|
||||
```
|
||||
|
||||
Note: Flatpak's `:create` modifier only works with directories, not files. Therefore, `~/.claude.json` cannot use `:create`. If this file doesn't exist on the user's machine, the app may not be able to create it with restricted permissions. Users should either run Claude Code once to generate it, or manually create an empty JSON file (content: `{}`).
|
||||
|
||||
If you plan to publish on Flathub or want stricter permission control, adjust the `finish-args` in `flatpak/com.ccswitch.desktop.yml` accordingly.
|
||||
9
flatpak/com.ccswitch.desktop.desktop
Normal file
9
flatpak/com.ccswitch.desktop.desktop
Normal file
@@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=CC Switch
|
||||
Comment=All-in-One Assistant for Claude Code, Codex & Gemini CLI
|
||||
Exec=cc-switch
|
||||
Icon=com.ccswitch.desktop
|
||||
Terminal=false
|
||||
Categories=Utility;Development;
|
||||
StartupNotify=true
|
||||
25
flatpak/com.ccswitch.desktop.metainfo.xml
Normal file
25
flatpak/com.ccswitch.desktop.metainfo.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop-application">
|
||||
<id>com.ccswitch.desktop</id>
|
||||
<name>CC Switch</name>
|
||||
<summary>All-in-One Assistant for Claude Code, Codex & Gemini CLI</summary>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>MIT</project_license>
|
||||
|
||||
<description>
|
||||
<p>CC Switch is a cross-platform desktop app for managing and switching provider configurations for Claude Code, Codex, and Gemini CLI.</p>
|
||||
<ul>
|
||||
<li>Manage multiple provider configurations and endpoints</li>
|
||||
<li>One-click switch and sync to client live configurations</li>
|
||||
<li>MCP servers and Prompt/Skills management</li>
|
||||
</ul>
|
||||
</description>
|
||||
|
||||
<launchable type="desktop-id">com.ccswitch.desktop.desktop</launchable>
|
||||
<provides>
|
||||
<binary>cc-switch</binary>
|
||||
</provides>
|
||||
|
||||
<url type="homepage">https://github.com/farion1231/cc-switch</url>
|
||||
<url type="bugtracker">https://github.com/farion1231/cc-switch/issues</url>
|
||||
</component>
|
||||
45
flatpak/com.ccswitch.desktop.yml
Normal file
45
flatpak/com.ccswitch.desktop.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
id: com.ccswitch.desktop
|
||||
|
||||
runtime: org.gnome.Platform
|
||||
runtime-version: '46'
|
||||
sdk: org.gnome.Sdk
|
||||
|
||||
command: cc-switch
|
||||
|
||||
finish-args:
|
||||
- --share=ipc
|
||||
- --share=network
|
||||
- --socket=wayland
|
||||
- --socket=fallback-x11
|
||||
- --device=dri
|
||||
# Tray icon permissions (required by Tauri tray-icon)
|
||||
- --talk-name=org.kde.StatusNotifierWatcher
|
||||
- --filesystem=xdg-run/tray-icon:create
|
||||
# GitHub Releases scenario: Users download and install manually.
|
||||
# For "download and run" convenience (needs read/write access to ~/.cc-switch, ~/.claude, ~/.claude.json, ~/.codex, ~/.gemini,
|
||||
# and supports custom directory overrides), we grant full Home access by default.
|
||||
# If you plan to publish on Flathub or prefer minimal permissions, replace this with more precise directory grants (see flatpak/README.md).
|
||||
- --filesystem=home
|
||||
|
||||
modules:
|
||||
- name: cc-switch
|
||||
buildsystem: simple
|
||||
sources:
|
||||
# Placed in flatpak/ directory by CI or local build script
|
||||
- type: file
|
||||
path: cc-switch.deb
|
||||
- type: file
|
||||
path: com.ccswitch.desktop.desktop
|
||||
- type: file
|
||||
path: com.ccswitch.desktop.metainfo.xml
|
||||
- type: file
|
||||
path: ../src-tauri/icons/128x128.png
|
||||
build-commands:
|
||||
- ar -x *.deb
|
||||
- tar -xf data.tar.*
|
||||
- cp -a usr/* /app/
|
||||
# Use our own desktop/metainfo/icon to align with Flatpak app id
|
||||
- rm -f /app/share/applications/*.desktop
|
||||
- install -Dm644 com.ccswitch.desktop.desktop /app/share/applications/com.ccswitch.desktop.desktop
|
||||
- install -Dm644 com.ccswitch.desktop.metainfo.xml /app/share/metainfo/com.ccswitch.desktop.metainfo.xml
|
||||
- install -Dm644 128x128.png /app/share/icons/hicolor/128x128/apps/com.ccswitch.desktop.png
|
||||
Reference in New Issue
Block a user