mirror of
https://github.com/Melorise/cc-switch-nix-flake.git
synced 2026-11-07 14:49:32 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03ad3bd6d1 | ||
|
|
fbf70cd1e1 | ||
|
|
95c916a1b3 | ||
|
|
412d93f188 | ||
|
|
dfaafb6e75 | ||
|
|
163dd2310d | ||
|
|
dcc0a776c4 | ||
|
|
cce9858060 | ||
|
|
4f1c14bdd5 | ||
|
|
ebf8d7373b | ||
|
|
0bc69ee0ca | ||
|
|
4ec4ae0f53 | ||
|
|
3b929ad11c | ||
|
|
26c8310b3e | ||
|
|
d01eea6f99 | ||
|
|
610309a201 | ||
|
|
3a07237fda | ||
|
|
003caecf0e | ||
|
|
398514a1bf | ||
|
|
b44fc1698b | ||
|
|
238bf640d7 |
@@ -0,0 +1,76 @@
|
||||
name: Update upstream version
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "17 2 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: update-upstream
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
update:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Update version in flake.nix
|
||||
id: update
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
latest_tag="$(curl --fail --silent --show-error --location \
|
||||
-H 'Accept: application/vnd.github+json' \
|
||||
-H "Authorization: Bearer $GH_TOKEN" \
|
||||
https://api.github.com/repos/farion1231/cc-switch/releases/latest \
|
||||
| jq --exit-status --raw-output '.tag_name')"
|
||||
latest_version="${latest_tag#v}"
|
||||
|
||||
if [[ ! "$latest_tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Unsupported upstream release tag: $latest_tag" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
current_version="$(sed -nE \
|
||||
's/^[[:space:]]*version = "([^"]+)";/\1/p' \
|
||||
flake.nix | head -n 1)"
|
||||
if [[ -z "$current_version" ]]; then
|
||||
echo "Could not find the package version in flake.nix" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
newest_version="$(printf '%s\n' "$current_version" "$latest_version" | sort -V | tail -n 1)"
|
||||
if [[ "$current_version" == "$latest_version" || "$newest_version" != "$latest_version" ]]; then
|
||||
echo "No newer release available; current version is $current_version"
|
||||
echo "updated=false" >> "$GITHUB_OUTPUT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
current_pattern="${current_version//./\\.}"
|
||||
sed -i -E "s/${current_pattern}/${latest_version}/g" flake.nix
|
||||
|
||||
echo "Updated CC Switch from $current_version to $latest_version"
|
||||
echo "updated=true" >> "$GITHUB_OUTPUT"
|
||||
echo "version=$latest_version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Commit and push version update
|
||||
if: steps.update.outputs.updated == 'true'
|
||||
env:
|
||||
VERSION: ${{ steps.update.outputs.version }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add flake.nix
|
||||
git commit -m "chore: update cc-switch to $VERSION"
|
||||
git push
|
||||
@@ -1,2 +1,8 @@
|
||||
cc-switch nix flake版
|
||||
官方nixpkgs更新太慢,appimage版又有输入错误,该版是从deb重打包的
|
||||
# cc-switch nix flake版
|
||||
官方nixpkgs更新太慢,appimage版又有输入错误,该版是从deb重打包的
|
||||
|
||||
GitHub Actions 每天北京时间 10:17(UTC 02:17)检查上游最新正式 Release。当上游版本高于当前版本时,工作流会替换 `flake.nix` 中的版本号(包括描述、下载链接和包版本),自动提交并推送。也可以通过 Actions 页面手动运行 `Update upstream version` 工作流。
|
||||
|
||||
# 已知问题
|
||||
因为nixos特殊的应用级隔离,在cc switch中修改claude code、codex等的配置目录不起作用
|
||||
建议:自行创建自定义目录到默认目录的链接,不要使用 cc switch修改
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
description = "CC Switch 3.20.3 repackaged from the upstream x86_64 Debian release";
|
||||
description = "CC Switch 4.0.26 repackaged from the upstream x86_64 Debian release";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
|
||||
cc-switch-x86_64 = {
|
||||
url = "file+https://github.com/farion1231/cc-switch/releases/download/v3.20.3/CC-Switch-v3.20.3-Linux-x86_64.deb";
|
||||
url = "file+https://github.com/farion1231/cc-switch/releases/download/v4.0.26/CC-Switch-v4.0.26-Linux-x86_64.deb";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
@@ -23,7 +23,7 @@
|
||||
packages.x86_64-linux = {
|
||||
cc-switch = pkgs.stdenv.mkDerivation {
|
||||
pname = "cc-switch";
|
||||
version = "3.20.3";
|
||||
version = "4.0.26";
|
||||
src = cc-switch-x86_64;
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
@@ -42,6 +42,8 @@
|
||||
xz
|
||||
];
|
||||
|
||||
runtimeDependencies = with pkgs; [ libayatana-appindicator ];
|
||||
|
||||
unpackPhase = ''
|
||||
bsdtar --extract --to-stdout --file "$src" data.tar.gz \
|
||||
| bsdtar --extract --file - --no-same-owner
|
||||
|
||||
Reference in New Issue
Block a user