Skip to content

Commit 00860bb

Browse files
committed
fix getting latest nixos version
1 parent f9a22b2 commit 00860bb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/update-nixos-release.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ jobs:
2424
env:
2525
GH_TOKEN: ${{ steps.app-token.outputs.token }}
2626
run: |
27-
BRANCHES=$(gh api repos/NixOS/nixpkgs/branches --paginate | grep -o '"name": "nixos-[0-9][0-9]\.[0-9][0-9]"' | grep -o '[0-9][0-9]\.[0-9][0-9]')
28-
LATEST_VERSION=$(echo "$BRANCHES" | sort -V | tail -1)
27+
LATEST_VERSION=$(
28+
gh api repos/NixOS/nixpkgs/branches --paginate |
29+
jq -r '.[] | select(.name | test("^nixos-[0-9]{2}\\.[0-9]{2}$")) | .name' |
30+
sort -V |
31+
tail -1
32+
)
2933
if [ -z "$LATEST_VERSION" ]; then
3034
echo "Failed to retrieve latest NixOS version from GitHub"
3135
exit 1
@@ -39,7 +43,7 @@ jobs:
3943
- name: Update NixOS version
4044
run: |
4145
NEW_VERSION="${{ steps.find-version.outputs.version }}"
42-
sed -i "s/nixos-[0-9][0-9]\.[0-9][0-9]/nixos-${NEW_VERSION}/g" flake.nix .github/workflows/build.yml
46+
sed -i "s/nixos-[0-9][0-9]\.[0-9][0-9]/${NEW_VERSION}/g" flake.nix .github/workflows/build.yml
4347
nix flake update
4448
4549
- name: Create Pull Request

0 commit comments

Comments
 (0)