name: Build KabOS Image

on:
  workflow_dispatch:

jobs:
  build:
    runs-on: docker

    steps:
      # ✅ STEP 1 — Correct repo checkout
      - name: Checkout repo
        uses: actions/checkout@v4

      # ✅ STEP 2 — Install tools
      - name: Install tools
        run: |
          apt update
          apt install -y podman git

      # ✅ STEP 3 — Build your custom image (IMPORTANT)
      - name: Build KabOS NVIDIA image
        run: |
          podman build -t kabos-nvidia -f Containerfile.nvidia .

      # ✅ STEP 4 — Build bootable image
      - name: Build bootable image
        run: |
          podman run --rm --privileged \
            -v /var/lib/containers:/var/lib/containers \
            -v $PWD:/output \
            quay.io/centos-bootc/bootc-image-builder:latest \
            --type qcow2 \
            localhost/kabos-nvidia:latest

      # ✅ STEP 5 — List output
      - name: List output
        run: |
          ls -lah