oizys/.github/workflows/update.yml

121 lines
3 KiB
YAML
Raw Normal View History

2024-07-16 12:41:05 -05:00
name: Flake Update / Build
2024-07-11 16:31:51 -05:00
on:
workflow_dispatch:
schedule:
- cron: 0 0 * * *
2024-07-11 23:33:26 -05:00
permissions:
contents: write
2024-07-11 16:31:51 -05:00
jobs:
2024-07-11 23:33:26 -05:00
build-minimal:
2024-07-11 16:31:51 -05:00
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
2024-07-12 09:55:23 -05:00
- run: git checkout -B flake-lock
2024-07-11 16:31:51 -05:00
2024-07-11 23:33:26 -05:00
- name: Setup Git Bot
run: |
git --version
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
2024-07-11 16:31:51 -05:00
- uses: DeterminateSystems/nix-installer-action@v12
with:
extra-conf: |
accept-flake-config = true
- uses: cachix/cachix-action@v15
with:
name: daylin
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Update nix flake
2024-07-11 23:38:18 -05:00
run: |
2024-07-12 09:55:23 -05:00
printf '# Flake Lock\n\n```txt\n' >> $GITHUB_STEP_SUMMARY
2024-07-11 23:33:26 -05:00
nix flake update --commit-lock-file 2>> $GITHUB_STEP_SUMMARY
2024-07-12 09:55:23 -05:00
printf '```\n' >> $GITHUB_STEP_SUMMARY
2024-07-11 16:31:51 -05:00
- name: Build
run: |
nix run . \
-- \
build --minimal \
--host "othalan" \
--flake . \
--verbose \
--debug \
-- \
--print-build-logs
2024-07-11 23:33:26 -05:00
- name: Commit Updates
2024-07-13 23:58:01 -05:00
run: git push --set-upstream --force origin flake-lock
2024-07-11 23:33:26 -05:00
build-full:
needs: build-minimal
runs-on: ubuntu-latest
2024-07-18 09:09:56 -05:00
strategy:
matrix:
hosts:
- othalan
- algiz
- mannaz
- naudiz
2024-07-11 23:33:26 -05:00
steps:
- name: Checkout
uses: actions/checkout@v4
2024-07-15 15:37:35 -05:00
with:
fetch-depth: 0
2024-07-11 23:33:26 -05:00
- uses: DeterminateSystems/nix-installer-action@v12
with:
extra-conf: |
accept-flake-config = true
- uses: ./.github/actions/clean-disk
with:
purge-packages: 'true'
2024-07-18 09:09:56 -05:00
2024-07-11 23:33:26 -05:00
- name: Build
run: |
2024-07-18 09:09:56 -05:00
system_attr=$(nix run . -- output --host "${{ matrix.host }}" --flake .)
2024-07-11 23:33:26 -05:00
nix run . \
-- \
2024-07-12 00:06:11 -05:00
build $system_attr \
2024-07-11 23:33:26 -05:00
--flake . \
--verbose \
--debug \
-- \
2024-07-15 13:25:30 -05:00
--print-build-logs \
--out-link current
2024-07-15 12:52:21 -05:00
2024-07-15 14:52:10 -05:00
- run: git checkout flake-lock
2024-07-15 12:52:21 -05:00
- name: Build Updated
run: |
2024-07-18 09:09:56 -05:00
system_attr=$(nix run . -- output --host "${{ matrix.host }}" --flake .)
2024-07-15 12:52:21 -05:00
nix run . \
-- \
build $system_attr \
--flake . \
--verbose \
--debug \
-- \
2024-07-15 13:25:30 -05:00
--print-build-logs \
--out-link updated
- run: |
echo "# System Diff" >> $GITHUB_STEP_SUMMARY
2024-07-17 12:34:27 -05:00
nix run "nixpkgs#nvd" -- --color always diff ./current ./updated >> summary.md
2024-07-17 17:26:17 -05:00
printf '```\n%s```\n' "$(nix run "nixpkgs#nvd" -- diff ./current ./updated)" >> $GITHUB_STEP_SUMMARY
2024-07-16 12:20:24 -05:00
2024-07-15 13:31:02 -05:00
- run: df -h
2024-07-15 15:19:28 -05:00
- uses: actions/upload-artifact@v4
with:
2024-07-18 09:09:56 -05:00
name: ${{ matrix.host }}-summary
2024-07-15 15:19:28 -05:00
path: summary.md