Watch
0
1
Fork
You've already forked nixos-configuration
0
nixos-configuration/.forgejo/workflows/build.yaml
2026-10-18 04:09:03 +02:00

56 lines
2 KiB
YAML

name: build
on:
pull_request: {}
push:
branches: [main]
jobs:
build:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
# keep-sorted start block=yes
- host: hetzner-vpn2
runner: nixos-aarch64
- host: hyperforge
runner: nixos-aarch64
- host: muede-lpt2
runner: nixos
- host: muede-pc2
runner: nixos
# keep-sorted end
steps:
- uses: https://code.forgejo.org/actions/checkout@v4
- run: nix build .#nixosConfigurations.${{ matrix.host }}.config.system.build.toplevel
- run: |
nix shell --inputs-from . nixpkgs#attic-client -c sh -c '
attic login preem https://preem-bincache.trollhive.monster "$PREEM_PUSH_TOKEN"
attic push preem:grid ./result
'
env:
PREEM_PUSH_TOKEN: ${{ secrets.PREEM_PUSH_TOKEN }}
# flake-update.yaml opens PRs from flake-update-* branches; if the
# build fails on one of those, close it and delete the branch rather
# than leaving a broken auto-generated PR around (and so a same-day
# rerun can push the branch again). Scoped to that branch prefix so a
# failing build on a human-authored PR is never auto-closed.
close-on-failure:
needs: build
if: failure() && startsWith(github.head_ref, 'flake-update-')
runs-on: nixos
steps:
- run: |
curl -sf -X PATCH \
-H "Authorization: token ${PR_BOT_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"state": "closed"}' \
"https://forge.darkest.space/api/v1/repos/mara/nixos-configs/pulls/${{ github.event.pull_request.number }}"
curl -sf -X DELETE \
-H "Authorization: token ${PR_BOT_TOKEN}" \
"https://forge.darkest.space/api/v1/repos/mara/nixos-configs/branches/${HEAD_REF}"
env:
PR_BOT_TOKEN: ${{ secrets.PR_BOT_TOKEN }}
HEAD_REF: ${{ github.head_ref }}