auto updater #16
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Flake updater" | |
on: | |
# schedule: | |
# - cron: "0 0 * * *" | |
workflow_dispatch: # allow manual triggering | |
pull_request: | |
push: | |
jobs: | |
update_homes: | |
strategy: | |
matrix: | |
pair: | |
- machine: "appaquet@deskapp" | |
os: ubuntu-latest | |
- machine: "appaquet@servapp" | |
os: ubuntu-latest | |
- machine: "appaquet@mbpapp" | |
os: macos-latest | |
runs-on: ${{ matrix.pair.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@main | |
with: | |
extra-conf: | | |
experimental-features = nix-command flakes | |
access-tokens = github.com=${{ secrets.GH_PAT }} | |
github-token: ${{ secrets.GH_PAT }} | |
- name: Add & update nixpkgs channel | |
run: | | |
nix-channel --add https://nixos.org/channels/nixos-24.05 nixpkgs | |
nix-channel --update nixpkgs | |
nix profile install nixpkgs#nvd | |
- name: Building Home Manager baseline... | |
run: | | |
set -xe | |
MACHINE_KEY="${{ matrix.pair.machine }}" ./x home build | |
mv result result-before | |
- name: Update flakes | |
run: | | |
set -xe | |
nix flake update | |
- name: Building Home Manager new | |
run: | | |
set -xe | |
MACHINE_KEY="${{ matrix.pair.machine }}" ./x home build | |
mv result result-after | |
- name: Diffing... | |
run: | | |
set -xe | |
nvd diff result-before result-after | tee diff | |
cat diff > "${{ matrix.pair.machine }}-home-diff" | |
- name: Add as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ matrix.pair.machine }}-home-diff" | |
path: "${{ matrix.pair.machine }}-home-diff" | |
if-no-files-found: ignore # no files means no diff | |
update_nixos: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
machine: ["appaquet@deskapp"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@main | |
with: | |
extra-conf: | | |
experimental-features = nix-command flakes | |
access-tokens = github.com=${{ secrets.GH_PAT }} | |
github-token: ${{ secrets.GH_PAT }} | |
- name: Add & update nixpkgs channel | |
run: | | |
nix-channel --add https://nixos.org/channels/nixos-24.05 nixpkgs | |
nix-channel --update nixpkgs | |
nix profile install nixpkgs#nixos-rebuild nixpkgs#nvd | |
- name: Building NixOS baseline... | |
run: | | |
set -xe | |
MACHINE_KEY="appaquet@deskapp" ./x nixos build | |
mv result result-before | |
- name: Update flakes | |
run: | | |
set -xe | |
nix flake update | |
- name: Building NixOS new | |
run: | | |
set -xe | |
MACHINE_KEY="appaquet@deskapp" ./x nixos build | |
mv result result-after | |
- name: Diffing... | |
run: | | |
set -xe | |
nvd diff result-before result-after | tee diff | |
cat diff > ${{ matrix.machine }}-nixos-diff | |
- name: Add as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ matrix.machine }}-nixos-diff" | |
path: "${{ matrix.machine }}-nixos-diff" | |
if-no-files-found: ignore # no files means no diff | |
update_darwin: | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
machine: ["appaquet@mbpapp"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@main | |
with: | |
extra-conf: | | |
experimental-features = nix-command flakes | |
access-tokens = github.com=${{ secrets.GH_PAT }} | |
github-token: ${{ secrets.GH_PAT }} | |
- name: Add & update nixpkgs channel | |
run: | | |
nix-channel --add https://nixos.org/channels/nixos-24.05 nixpkgs | |
nix-channel --update nixpkgs | |
nix profile install nixpkgs#nvd | |
- name: Building baseline... | |
run: | | |
set -xe | |
MACHINE_KEY="${{ matrix.machine }}" ./x darwin build | |
mv result darwin-result-before | |
- name: Update flakes | |
run: | | |
set -xe | |
nix flake update | |
- name: Building new... | |
run: | | |
set -xe | |
MACHINE_KEY="${{ matrix.machine }}" ./x darwin build | |
mv result darwin-result-after | |
- name: Diffing... | |
run: | | |
set -xe | |
nvd diff ./darwin-result-before ./darwin-result-after | tee diff | |
cat diff > ${{ matrix.machine }}-darwin-diff | |
- name: Add as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "${{ matrix.machine }}-darwin-diff" | |
path: "${{ matrix.machine }}-darwin-diff" | |
if-no-files-found: ignore # no files means no diff | |
create_pr: | |
runs-on: ubuntu-latest | |
needs: [update_homes, update_nixos, update_darwin] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Fetch all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: diffs | |
- name: Create PR | |
run: | | |
set -xe | |
ls -l diffs/* | |
cat diffs/* | |