From a8820aae0ffbf46a7050458f0fd471f2307a0913 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Thu, 23 Jun 2022 16:44:10 +0800 Subject: [PATCH] chore: add flake update automation This is used for testing updates and gauging how up-to-date my config is. In case of failure, it should not update it. --- .github/workflows/automate-update.yml | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/automate-update.yml diff --git a/.github/workflows/automate-update.yml b/.github/workflows/automate-update.yml new file mode 100644 index 00000000..788fdd4f --- /dev/null +++ b/.github/workflows/automate-update.yml @@ -0,0 +1,32 @@ +name: "Automated flake inputs update" +on: + schedule: + # Every week on Friday. + - cron: '0 * * * 5' +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v16 + with: + nix_path: nixpkgs=channel:nixos-unstable + - name: Update flake inputs + run: | + nix shell nixpkgs#git + + # This is set by the GitHub Actions bot just to make identifying which commits are automated. + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + + nix flake update --commit-lock-file \ + --commit-lockfile-summary 'flake.lock: update-inputs' + - name: Build custom packages + run: nix shell nixpkgs#nix-build-uncached --command nix-build-uncached ./pkgs + - name: Build NixOS configurations + run: nix build .#nixosConfigurations.ni.config.system.build.toplevel + - name: Push updates to remote + run: | + git remote remove origin + git remote add origin https://${{ secrets.GITHUB_TOKEN }}@github.com/foo-dogsquared/nixos-config.git + git push --set-upstream origin master --tags