forked from Bos55/nix-config
49 lines
1.4 KiB
YAML
49 lines
1.4 KiB
YAML
name: "Build"
|
|
on:
|
|
pull_request:
|
|
push:
|
|
|
|
jobs:
|
|
determine-hosts:
|
|
name: "Determining hosts to build"
|
|
runs-on: ubuntu-latest
|
|
container: catthehacker/ubuntu:act-24.04
|
|
outputs:
|
|
hosts: ${{ steps.hosts.outputs.hostnames }}
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: cachix/install-nix-action@v31
|
|
with:
|
|
nix_path: nixpkgs=channel:nixos-unstable
|
|
- name: "Determine hosts"
|
|
id: hosts
|
|
run: |
|
|
hostnames="$(nix eval .#nixosConfigurations --apply builtins.attrNames --json)"
|
|
printf "hostnames=%s\n" "${hostnames}" >> "${GITHUB_OUTPUT}"
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
container: catthehacker/ubuntu:act-24.04
|
|
needs: determine-hosts
|
|
strategy:
|
|
matrix:
|
|
hostname: [
|
|
Development,
|
|
Testing
|
|
]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: cachix/install-nix-action@v31
|
|
with:
|
|
nix_path: nixpkgs=channel:nixos-unstable
|
|
- name: "Build host"
|
|
run: |
|
|
nix build ".#nixosConfigurations.${{ matrix.hostname }}.config.system.build.toplevel" --verbose
|
|
- name: "Push to Attic"
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
run: |
|
|
nix profile install nixpkgs#attic-client
|
|
attic login homelab http://192.168.0.25:8080 "${{ secrets.ATTIC_TOKEN }}"
|
|
attic push homelab result
|
|
|