install-nix-action/.github/workflows/update-nix.yml
dependabot[bot] b4dc112147
chore(deps): bump actions/checkout from 4 to 5
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-12 11:06:11 +00: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@v5
- 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