name: "Build personalized bootstrap ISO"
on:
  push:
    branches:
      - master
    paths-ignore:
      - docs/
jobs:
  build-iso:
    strategy:
      matrix:
        arch:
          - "x86_64-linux"
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: DeterminateSystems/nix-installer-action@v14
      - uses: DeterminateSystems/magic-nix-cache-action@v8
      - name: Build ISO
        run: |
          nix build .#images.${{ matrix.arch }}.bootstrap-install-iso --impure --out-link build-iso-result
        env:
          NIXPKGS_ALLOW_BROKEN: "1"
          NIXPKGS_ALLOW_UNFREE: "1"
      - name: Create release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          gh release delete latest --cleanup-tag --yes || true
          gh release create latest --prerelease --generate-notes build-iso-result/iso/*.iso
