Skip to content

Commit 39be3c7

Browse files
committed
ISO builds
1 parent 65fd445 commit 39be3c7

File tree

2 files changed

+48
-62
lines changed

2 files changed

+48
-62
lines changed

.github/workflows/build-disk.yml

Lines changed: 48 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,45 @@
11
---
2-
name: Build disk images
2+
name: Build ISO images
33

44
on:
55
workflow_dispatch:
66
inputs:
7-
upload-to-s3:
8-
description: "Upload to S3"
7+
create-release:
8+
description: "Create GitHub Release"
99
required: false
1010
default: false
1111
type: boolean
12-
platform:
13-
required: true
14-
type: choice
15-
options:
16-
- amd64
17-
- arm64
18-
pull_request:
19-
branches:
20-
- main
21-
paths:
22-
- './disk_config/disk.toml'
23-
- './disk_config/iso.toml'
24-
- './.github/workflows/build-disk.yml'
12+
release-tag:
13+
description: "Release tag (e.g., v1.0.0) - required if creating release"
14+
required: false
15+
type: string
2516

2617
env:
27-
IMAGE_NAME: ${{ github.event.repository.name }} # output of build.yml, keep in sync
28-
IMAGE_REGISTRY: "ghcr.io/${{ github.repository_owner }}" # do not edit
18+
IMAGE_NAME: ${{ github.event.repository.name }}
19+
IMAGE_REGISTRY: "ghcr.io/${{ github.repository_owner }}"
2920
DEFAULT_TAG: "latest"
30-
BIB_IMAGE: "ghcr.io/lorbuschris/bootc-image-builder:20250608" # "quay.io/centos-bootc/bootc-image-builder:latest" - see https://github.com/osbuild/bootc-image-builder/pull/954
21+
BIB_IMAGE: "quay.io/centos-bootc/bootc-image-builder:latest"
3122

3223
concurrency:
3324
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
3425
cancel-in-progress: true
3526

3627
jobs:
3728
build:
38-
name: Build disk images
39-
runs-on: ${{ inputs.platform == 'amd64' && 'ubuntu-latest-m' || 'ubuntu-24.04-arm' }}
29+
name: Build ISO (${{ matrix.variant.name }})
30+
runs-on: ubuntu-latest-m
4031
strategy:
4132
fail-fast: false
4233
matrix:
43-
disk-type: ["qcow2", "anaconda-iso"]
34+
variant:
35+
- name: "regular"
36+
tag: "latest"
37+
config: "./disk_config/iso-regular.toml"
38+
- name: "nvidia"
39+
tag: "latest-nvidia"
40+
config: "./disk_config/iso-nvidia.toml"
4441
permissions:
45-
contents: read
42+
contents: write
4643
packages: read
4744
id-token: write
4845

@@ -51,65 +48,54 @@ jobs:
5148
run: |
5249
USER_UID=$(id -u)
5350
USER_GID=$(id -g)
54-
# Concatenate the types with a hyphen
55-
DISK_TYPE=$(echo "${{ matrix.disk-type }}" | tr ' ' '-')
56-
# Lowercase the image uri
5751
echo "IMAGE_REGISTRY=${IMAGE_REGISTRY,,}" >> ${GITHUB_ENV}
5852
echo "IMAGE_NAME=${IMAGE_NAME,,}" >> ${GITHUB_ENV}
59-
echo "DISK_TYPE=${DISK_TYPE}" >> ${GITHUB_ENV}
6053
echo "USER_UID=${USER_UID}" >> ${GITHUB_ENV}
6154
echo "USER_GID=${USER_GID}" >> ${GITHUB_ENV}
6255
63-
- name: Install dependencies
64-
if: inputs.platform == 'arm64'
65-
run: |
66-
set -x
67-
sudo apt update -y
68-
sudo apt install -y \
69-
podman
70-
7156
- name: Maximize build space
72-
if: inputs.platform != 'arm64'
7357
uses: ublue-os/remove-unwanted-software@cc0becac701cf642c8f0a6613bbdaf5dc36b259e # v9
7458
with:
7559
remove-codeql: true
7660

7761
- name: Checkout
78-
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5
62+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
7963

80-
- name: Build disk images
64+
- name: Build ISO
8165
id: build
8266
uses: osbuild/bootc-image-builder-action@main
8367
with:
8468
builder-image: ${{ env.BIB_IMAGE }}
85-
config-file: ${{ matrix.disk-type == 'anaconda-iso' && './disk_config/iso.toml' || './disk_config/disk.toml' }}
86-
image: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.DEFAULT_TAG }}
69+
config-file: ${{ matrix.variant.config }}
70+
image: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.variant.tag }}
8771
chown: ${{ env.USER_UID }}:${{ env.USER_GID }}
88-
types: ${{ matrix.disk-type }}
72+
types: anaconda-iso
8973
additional-args: --use-librepo=True
9074

91-
- name: Upload disk images and Checksum to Job Artifacts
92-
if: inputs.upload-to-s3 != true && github.event_name != 'pull_request'
93-
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v4
75+
- name: Rename ISO for release
76+
id: rename
77+
run: |
78+
ISO_DIR="${{ steps.build.outputs.output-directory }}"
79+
ORIGINAL_ISO=$(find "$ISO_DIR" -name "*.iso" -type f | head -1)
80+
NEW_NAME="${{ env.IMAGE_NAME }}-${{ matrix.variant.name }}.iso"
81+
mv "$ORIGINAL_ISO" "$ISO_DIR/$NEW_NAME"
82+
echo "iso-path=$ISO_DIR/$NEW_NAME" >> $GITHUB_OUTPUT
83+
echo "iso-name=$NEW_NAME" >> $GITHUB_OUTPUT
84+
85+
- name: Upload ISO as artifact
86+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
9487
with:
88+
name: ${{ env.IMAGE_NAME }}-${{ matrix.variant.name }}-iso
9589
path: ${{ steps.build.outputs.output-directory }}
9690
if-no-files-found: error
97-
retention-days: 0
91+
retention-days: 7
9892
compression-level: 0
99-
overwrite: true
100-
101-
- name: Upload to S3
102-
if: inputs.upload-to-s3 == true && github.event_name != 'pull_request'
103-
shell: bash
104-
env:
105-
RCLONE_CONFIG_S3_TYPE: s3
106-
RCLONE_CONFIG_S3_PROVIDER: ${{ secrets.S3_PROVIDER }}
107-
RCLONE_CONFIG_S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
108-
RCLONE_CONFIG_S3_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
109-
RCLONE_CONFIG_S3_REGION: ${{ secrets.S3_REGION }}
110-
RCLONE_CONFIG_S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
111-
SOURCE_DIR: ${{ steps.build.outputs.output-directory }}
112-
run: |
113-
sudo apt-get update
114-
sudo apt-get install -y rclone
115-
rclone copy $SOURCE_DIR S3:${{ secrets.S3_BUCKET_NAME }}
93+
94+
- name: Upload ISO to release
95+
if: inputs.create-release == true && inputs.release-tag != ''
96+
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2
97+
with:
98+
tag_name: ${{ inputs.release-tag }}
99+
files: ${{ steps.rename.outputs.iso-path }}
100+
fail_on_unmatched_files: true
101+
generate_release_notes: true

0 commit comments

Comments
 (0)