name: "Build personalized bootstrap ISO"
on:
  push:
    branches:
      - master
    paths-ignore:
      - docs/
jobs:
  build-iso:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: DeterminateSystems/magic-nix-cache-action@v2
      - uses: DeterminateSystems/nix-installer-action@v4
      - name: Build ISO
        run: |
          nix build .#images.bootstrap --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