oizys/.github/workflows/update.yml
2024-08-06 12:07:01 -05:00

119 lines
2.9 KiB
YAML

name: Flake Update / Build
on:
workflow_dispatch:
schedule:
- cron: 0 0 * * *
permissions:
contents: write
jobs:
build-minimal:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: daylin-bot/actions/setup@main
- uses: ./.github/actions/clean-disk
- run: git checkout -B flake-lock
- uses: DeterminateSystems/nix-installer-action@v13
with:
source-url: https://install.lix.systems/lix/lix-installer-x86_64-linux
extra-conf: |
accept-flake-config = true
- uses: cachix/cachix-action@v15
with:
name: daylin
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Update nix flake
run: |
printf '# Flake Lock\n\n```txt\n' >> $GITHUB_STEP_SUMMARY
nix flake update --commit-lock-file 2>> $GITHUB_STEP_SUMMARY
printf '```\n' >> $GITHUB_STEP_SUMMARY
- name: Build
run: |
nix run . \
-- \
build --minimal \
--host "othalan" \
--flake . \
--debug \
-- \
--print-build-logs
- name: Commit Updates
uses: daylin-bot/actions/commit-and-push@main
with:
push-args: --set-upstream --force origin flake-lock
build-full:
needs: build-minimal
runs-on: ubuntu-latest
strategy:
matrix:
host:
- othalan
- algiz
- mannaz
- naudiz
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: DeterminateSystems/nix-installer-action@v13
with:
extra-conf: |
accept-flake-config = true
- uses: ./.github/actions/clean-disk
with:
purge-packages: 'true'
- name: Build
run: |
system_attr=$(nix run . -- output --host "${{ matrix.host }}" --flake .)
nix run . \
-- \
build $system_attr \
--flake . \
--debug \
-- \
--print-build-logs \
--out-link current
- run: git checkout flake-lock
- name: Build Updated
run: |
system_attr=$(nix run . -- output --host "${{ matrix.host }}" --flake .)
nix run . \
-- \
build $system_attr \
--flake . \
--debug \
-- \
--keep-going \
--print-build-logs \
--out-link updated
- run: |
echo "# System Diff" >> $GITHUB_STEP_SUMMARY
nix run "nixpkgs#nvd" -- --color always diff ./current ./updated >> summary.md
printf '```\n%s```\n' "$(nix run "nixpkgs#nvd" -- diff ./current ./updated)" >> $GITHUB_STEP_SUMMARY
- run: df -h
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.host }}-summary
path: summary.md