|
| 1 | +name: Build Images |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [ "main", "rewrite" ] |
| 5 | + |
| 6 | +jobs: |
| 7 | + build: |
| 8 | + name: Build ${{ matrix.system }} |
| 9 | + runs-on: ${{ matrix.os }} |
| 10 | + strategy: |
| 11 | + fail-fast: false |
| 12 | + matrix: |
| 13 | + include: |
| 14 | + - system: x86_64-linux |
| 15 | + os: ubuntu-latest |
| 16 | + # maybe in the future, but without kvm there is no reason to try |
| 17 | + # - system: aarch64-linux |
| 18 | + # os: ubuntu-24.04-arm |
| 19 | + permissions: |
| 20 | + contents: write |
| 21 | + id-token: write |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Maximize Disk Space |
| 26 | + uses: wimpysworld/nothing-but-nix@main |
| 27 | + |
| 28 | + - name: Install Nix |
| 29 | + uses: DeterminateSystems/determinate-nix-action@main |
| 30 | + |
| 31 | + - name: Magic Nix Cache |
| 32 | + uses: DeterminateSystems/magic-nix-cache-action@main |
| 33 | + |
| 34 | + - name: Build All Images |
| 35 | + run: | |
| 36 | + SHORT_SHA=$(git rev-parse --short HEAD) |
| 37 | + # We force KVM feature so Nix falls back to emulation on non-KVM CI |
| 38 | + nix build .#images.${{ matrix.system }}.all --option system-features "nixos-test benchmark big-parallel kvm" |
| 39 | + |
| 40 | + mkdir -p versioned-dist/ |
| 41 | + cp -rL result/* versioned-dist/ |
| 42 | + mv versioned-dist/nixos.qcow2 versioned-dist/${{ github.ref_name }}-$SHORT_SHA-${{ matrix.system }}.qcow2 |
| 43 | +
|
| 44 | + # Prepare artifacts for rolling release (latest-branch) |
| 45 | + mkdir -p rolling-dist/images/${{ matrix.system }} |
| 46 | + cp -rL result/* rolling-dist/images/${{ matrix.system }}/ |
| 47 | +
|
| 48 | + - name: Create Versioned Release (Pinned) |
| 49 | + uses: softprops/action-gh-release@v2 |
| 50 | + with: |
| 51 | + tag_name: ${{ github.ref_name }}-${{ github.sha }} |
| 52 | + name: "${{ github.ref_name }} @ ${{ github.sha }}" |
| 53 | + files: versioned-dist/* |
| 54 | + prerelease: true |
| 55 | + |
| 56 | + - name: Update Rolling Release (Latest) |
| 57 | + uses: softprops/action-gh-release@v2 |
| 58 | + with: |
| 59 | + tag_name: latest-${{ github.ref_name }} |
| 60 | + name: "Latest ${{ github.ref_name }} Bootstrap" |
| 61 | + files: rolling-dist/** |
| 62 | + prerelease: true |
0 commit comments