install-nix-action/.github/workflows/update-nix.yml
Sander f0fe604f8a
Some checks failed
install-nix-action test / simple-build (ubuntu-latest) (push) Failing after 51s
install-nix-action test / custom-nix-path (ubuntu-latest) (push) Failing after 15s
install-nix-action test / extra-nix-config (ubuntu-latest) (push) Failing after 3s
install-nix-action test / flakes (ubuntu-latest) (push) Failing after 3s
install-nix-action test / latest-installer (ubuntu-latest, x86_64-linux) (push) Failing after 14s
install-nix-action test / oldest-supported-installer (ubuntu-latest) (push) Failing after 13s
install-nix-action test / act-support (ubuntu-latest) (push) Failing after 13s
install-nix-action test / simple-build (macos-13) (push) Has been cancelled
install-nix-action test / simple-build (macos-latest) (push) Has been cancelled
install-nix-action test / simple-build (ubuntu-24.04-arm) (push) Has been cancelled
install-nix-action test / custom-nix-path (macos-13) (push) Has been cancelled
install-nix-action test / custom-nix-path (macos-latest) (push) Has been cancelled
install-nix-action test / custom-nix-path (ubuntu-24.04-arm) (push) Has been cancelled
install-nix-action test / extra-nix-config (macos-13) (push) Has been cancelled
install-nix-action test / extra-nix-config (macos-latest) (push) Has been cancelled
install-nix-action test / extra-nix-config (ubuntu-24.04-arm) (push) Has been cancelled
install-nix-action test / flakes (macos-13) (push) Has been cancelled
install-nix-action test / flakes (macos-latest) (push) Has been cancelled
install-nix-action test / flakes (ubuntu-24.04-arm) (push) Has been cancelled
install-nix-action test / latest-installer (macos-13, x86_64-darwin) (push) Has been cancelled
install-nix-action test / latest-installer (macos-latest, aarch64-darwin) (push) Has been cancelled
install-nix-action test / latest-installer (ubuntu-24.04-arm, aarch64-linux) (push) Has been cancelled
install-nix-action test / oldest-supported-installer (macos-13) (push) Has been cancelled
install-nix-action test / oldest-supported-installer (macos-latest) (push) Has been cancelled
install-nix-action test / oldest-supported-installer (ubuntu-24.04-arm) (push) Has been cancelled
ci: improve the automated nix bump title and commit message
2025-06-24 18:13:22 +02:00

52 lines
1.7 KiB
YAML

name: "Update nix"
on:
repository_dispatch:
workflow_dispatch:
schedule:
- cron: "31 2 * * *"
jobs:
update-nix-releases:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update nix releases
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
latest_nix=$(
gh api repos/NixOS/nix/tags --paginate --jq '.[].name' |
grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' |
sort -V |
tail -n 1
)
if [ -z "$latest_nix" ]; then
echo "Failed to determine latest Nix version." >&2
exit 1
fi
current_nix=$(grep -oE 'nix_version=[0-9.]+' ./install-nix.sh | cut -d= -f2)
echo "Current Nix version: ${current_nix}"
echo "Latest Nix version: ${latest_nix}"
echo "CURRENT_NIX=${current_nix}" >> $GITHUB_ENV
echo "LATEST_NIX=${latest_nix}" >> $GITHUB_ENV
sed -i -E "s/nix_version=[0-9.]+/nix_version=${latest_nix}/" ./install-nix.sh
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
title: "nix: ${{ env.CURRENT_NIX }} -> ${{ env.LATEST_NIX }}"
commit-message: "nix: ${{ env.CURRENT_NIX }} -> ${{ env.LATEST_NIX }}"
body: |
This PR updates the Nix version from ${{ env.CURRENT_NIX }} to ${{ env.LATEST_NIX }}.
**To trigger the CI:**
1. Checkout the PR branch:
```bash
gh pr checkout <pr-number>
```
2. Amend and force push:
```bash
git commit --amend --no-edit
git push --force-with-lease
```
labels: dependencies