All checks were successful
build-flake / Build flake (push) Successful in 5m42s
build-flake / Release a new version (push) Successful in 8s
Sync flake lock with main nix-configuration project / Sync flake lock with main nix-configuration project (push) Successful in 6m3s
Sync flake lock with main nix-configuration project / Release a new version (push) Successful in 8s
65 lines
2.3 KiB
YAML
65 lines
2.3 KiB
YAML
name: Sync flake lock with main nix-configuration project
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "15 3 * * *"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
update:
|
|
permissions:
|
|
contents: write
|
|
name: Sync flake lock with main nix-configuration project
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
changes: ${{ steps.checkChanges.outputs.CHANGES }}
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v6
|
|
- name: Checkout nix-configuration repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
repository: xaked/nix-config
|
|
path: nix-config
|
|
ref: master
|
|
token: ${{ secrets.NIX_CONFIGURATION_GITEA_CLONE_TOKEN }}
|
|
- name: Setup sudo and jq (required for the next step)
|
|
run: apt-get update && apt-get install -y sudo jq
|
|
- name: Setup nix
|
|
uses: cachix/install-nix-action@v31
|
|
with:
|
|
extra_nix_config: |
|
|
experimental-features = nix-command flakes
|
|
github_access_token: ${{ secrets.GH_ACCESS_TOKEN }}
|
|
nix_path: nixpkgs=channel:nixos-25.11
|
|
- name: Check for update and perform update
|
|
id: checkChanges
|
|
run: |
|
|
git config user.name gitea-bot
|
|
git config user.email bot@git.palkoi.net
|
|
git config --global user.email bot@git.palkoi.net
|
|
git config --global user.name gitea-bot
|
|
|
|
tmpfile="$(mktemp)"
|
|
jq -srM '.[1].nodes.nixpkgs = .[0].nodes.nixpkgs_2|.[1].nodes.nixpkgs_2 = .[0].nodes.nixpkgs_2 | .[1]' ./nix-config/flake.lock flake.lock > "$tmpfile"
|
|
cat "$tmpfile" > flake.lock
|
|
git add flake.lock
|
|
if [ -n "$(git diff --cached)" ]; then echo 'CHANGES=y'>>$GITHUB_OUTPUT; else echo 'CHANGES=n'>>$GITHUB_OUTPUT; fi
|
|
- name: Build nix flake
|
|
if: ${{ steps.checkChanges.outputs.CHANGES == 'y' }}
|
|
run: |
|
|
nix build .
|
|
- name: Check nix flake
|
|
if: ${{ steps.checkChanges.outputs.CHANGES == 'y' }}
|
|
run: nix flake check --all-systems
|
|
- name: Commit updates
|
|
if: ${{ steps.checkChanges.outputs.CHANGES == 'y' }}
|
|
run: |
|
|
git commit --no-gpg-sign -m 'chore(flake): update flake.lock'
|
|
git push
|
|
release:
|
|
name: Release a new version
|
|
if: ${{ needs.update.outputs.changes == 'y' }}
|
|
needs: update
|
|
uses: xaked/actions/.gitea/workflows/cog-release.yml@2.0.0
|