From 94ba45492a822dba89821a985916767dcaed2518 Mon Sep 17 00:00:00 2001 From: cookieidea Date: Tue, 29 Sep 2026 19:02:20 +0800 Subject: [PATCH 1/2] =?UTF-8?q?ci:=20=E8=87=AA=E5=8A=A8=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20flake=20=E7=9A=84=E7=89=88=E6=9C=AC=E4=B8=8E=E5=93=88?= =?UTF-8?q?=E5=B8=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 每天检查上游 release,版本变化时重新计算 src hash 并提交。 --- .github/workflows/update-flake.yml | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/update-flake.yml diff --git a/.github/workflows/update-flake.yml b/.github/workflows/update-flake.yml new file mode 100644 index 000000000..b20ef23f3 --- /dev/null +++ b/.github/workflows/update-flake.yml @@ -0,0 +1,54 @@ +name: Update flake + +on: + schedule: + - cron: "0 4 * * *" + workflow_dispatch: + +permissions: + contents: write + +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: cachix/install-nix-action@v27 + + - name: Read current version + id: current + run: | + version=$(sed -n 's/.*version = "\(.*\)";/\1/p' flake.nix | head -1) + echo "version=$version" >> "$GITHUB_OUTPUT" + + - name: Resolve latest release + id: latest + run: | + tag=$(curl -fsSL https://api.github.com/repos/BestProjectTeam/BestClient/releases/latest \ + | jq -r .tag_name) + version=${tag#v} + url="https://github.com/BestProjectTeam/BestClient/releases/download/${tag}/BestClient-linux.tar.xz" + hash=$(nix store prefetch-file --json "$url" | jq -r .hash) + echo "version=$version" >> "$GITHUB_OUTPUT" + echo "hash=$hash" >> "$GITHUB_OUTPUT" + + - name: Update flake.nix + if: steps.current.outputs.version != steps.latest.outputs.version + run: | + sed -i "s|version = \"[^\"]*\";|version = \"${{ steps.latest.outputs.version }}\";|" flake.nix + sed -i "s|hash = \"sha256-[^\"]*\";|hash = \"${{ steps.latest.outputs.hash }}\";|" flake.nix + git diff --stat + + - name: Build + if: steps.current.outputs.version != steps.latest.outputs.version + run: nix build --no-link .#default + + - name: Commit + if: steps.current.outputs.version != steps.latest.outputs.version + run: | + 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 "flake: update bestclient to ${{ steps.latest.outputs.version }}" + git push From affaae434974c26df83bf3e5434394fc1379fd86 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 29 Sep 2026 11:04:50 +0000 Subject: [PATCH 2/2] flake: update bestclient to 3.0 --- flake.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index b1d75162e..2986df3f8 100644 --- a/flake.nix +++ b/flake.nix @@ -10,11 +10,11 @@ in { packages.${system}.default = pkgs.stdenv.mkDerivation rec { pname = "bestclient"; - version = "2.3"; + version = "3.0"; src = pkgs.fetchurl { url = "https://github.com/BestProjectTeam/BestClient/releases/download/v${version}/BestClient-linux.tar.xz"; - hash = "sha256-ngp73/RXIY1nCky3hhrTN+gRlBJVyw9TJJAMNTjpy6o="; + hash = "sha256-esKwubZZ0LpVk9FffezuYZaX6YC5GvNNw3aHN0md3P4="; }; nativeBuildInputs = [