oizys/.github/workflows/update.yml

128 lines
3.1 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:
2024-11-19 14:35:29 -06:00
inputs:
hosts:
description: 'list of hosts to build'
required: true
default: 'othalan,algiz'
type: string
2024-07-11 16:31:51 -05:00
schedule:
2024-10-23 10:28:34 -05:00
# At minute 00:00 on Monday, Wednesday, and Friday.
- cron: 0 0 * * 1,3,5
2024-07-11 16:31:51 -05:00
2024-11-20 11:03:07 -06:00
env:
hosts: ${{ github.event_name == 'schedule' && 'othalan,algiz' || github.event.inputs.hosts }}
2024-07-11 23:33:26 -05:00
permissions:
contents: write
2024-07-11 16:31:51 -05:00
2024-08-09 13:05:34 -05:00
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
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-11-04 12:27:17 -06:00
# needed to access ghostty repo for now
2024-11-03 09:33:36 -06:00
- name: Setup SSH
2024-11-04 12:27:17 -06:00
uses: MrSquaare/ssh-setup-action@v3
2024-11-03 09:33:36 -06:00
with:
host: github.com
private-key: ${{ secrets.SSH_PRIVATE_KEY }}
2024-07-25 15:06:45 -05:00
- uses: daylin-bot/actions/setup@main
2024-11-18 13:05:57 -06:00
- uses: ./.github/actions/nix
2024-07-11 16:31:51 -05:00
with:
2024-11-18 13:05:57 -06:00
attic_token: ${{ secrets.ATTIC_TOKEN }}
2024-07-11 16:31:51 -05:00
2024-11-18 13:05:57 -06:00
- run: git checkout -B flake-lock
2024-07-11 16:31:51 -05:00
- name: Update nix flake
2024-07-11 23:38:18 -05:00
run: |
nix flake update --commit-lock-file
2024-10-04 14:37:10 -05:00
printf '# Flake Lock\n\n```txt\n%s```\n' \
"$(git show -s --format='%B')" \
>> $GITHUB_STEP_SUMMARY
2024-07-11 16:31:51 -05:00
2024-08-07 13:07:38 -05:00
- name: Pre-build oizys
2024-11-03 09:48:13 -06:00
run: |
nix build .
attic push oizys result
2024-08-07 13:07:38 -05:00
2024-07-11 16:31:51 -05:00
- name: Build
2024-08-28 10:31:00 -05:00
run: >
nix run .
--
2024-10-29 16:59:11 -05:00
cache
2024-11-20 11:03:07 -06:00
--host,="${{ env.hosts }}"
2024-08-28 10:31:00 -05:00
--flake .
--debug
2024-11-19 09:54:28 -06:00
--
--quiet
2024-07-11 23:33:26 -05:00
- name: Commit Updates
2024-07-25 15:06:45 -05:00
uses: daylin-bot/actions/commit-and-push@main
with:
push-args: --set-upstream --force origin flake-lock
2024-07-11 23:33:26 -05:00
2024-11-19 09:39:31 -06:00
2024-11-19 14:03:36 -06:00
build-full:
2024-11-19 09:39:31 -06:00
needs: build-minimal
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# needed to access ghostty repo for now
- name: Setup SSH
uses: MrSquaare/ssh-setup-action@v3
with:
host: github.com
private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: daylin-bot/actions/setup@main
- uses: ./.github/actions/nix
with:
attic_token: ${{ secrets.ATTIC_TOKEN }}
2024-11-19 11:54:53 -06:00
# clean: true
2024-11-19 09:39:31 -06:00
btrfs: true
- name: Pre-build oizys
run: nix build .
2024-11-19 13:18:33 -06:00
- name: Build Current and Updated Systems
2024-11-19 09:39:31 -06:00
run: >
nix run .
2024-11-19 14:03:36 -06:00
--
2024-11-19 13:18:33 -06:00
ci update
2024-11-20 11:03:07 -06:00
--host,="${{ env.hosts }}"
2024-11-19 09:39:31 -06:00
--flake .
--debug
--
2024-11-19 13:18:33 -06:00
--quiet
2024-11-19 11:54:53 -06:00
- run: |
2024-11-19 14:03:36 -06:00
echo "# system diffs" >> $GITHUB_STEP_SUMMARY
2024-11-20 11:03:07 -06:00
hosts="${{ env.hosts }}"
2024-11-19 14:35:29 -06:00
for host in ${hosts//,/ }; do
2024-11-19 14:03:36 -06:00
echo "## $host" >> $GITHUB_STEP_SUMMARY
2024-11-19 13:18:33 -06:00
nix run "nixpkgs#nvd" -- --color always diff ./$host-current ./$host-updated >> $host-summary.md
printf '```\n%s\n```\n' "$(nix run "nixpkgs#nvd" -- diff ./$host-current ./$host-updated)" >> $GITHUB_STEP_SUMMARY
2024-11-19 11:54:53 -06:00
done
2024-11-19 09:39:31 -06:00
- run: df -h
2024-11-19 13:18:33 -06:00
- uses: actions/upload-artifact@v4
with:
name: summary
path: '*-summary.md'