diff --git a/.github/workflows/iso.yml b/.github/workflows/iso.yml index f56adcd..4290856 100644 --- a/.github/workflows/iso.yml +++ b/.github/workflows/iso.yml @@ -9,7 +9,10 @@ on: pull_request: env: - IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} + IMAGE_VERSION: 39 + IMAGE_ARCH: x86_64 + IMAGE_NAME: base-main + IMAGE_REPO: ghcr.io/ublue-os jobs: @@ -34,53 +37,46 @@ jobs: rm -rf /host/usr/local/.ghcup || true df -h /host || true - - name: Install tools - run: | - dnf install -y \ - lorax \ - xorriso \ - podman \ - git \ - rpm-ostree + - name: Install make and git + run: dnf install -y make git - name: Checkout repository uses: actions/checkout@v4 with: submodules: recursive + - name: Install dependencies + run: make install-deps + - name: Download image run: | - podman pull ghcr.io/ublue-os/base-main:39 - podman save --format oci-dir -o base-main-39 ghcr.io/ublue-os/base-main:39 - podman rmi ghcr.io/ublue-os/base-main:39 + make ${IMAGE_NAME}-${IMAGE_VERSION} \ + arch=${IMAGE_ARCH} \ + version=${IMAGE_VERSION} \ + image_repo=${IMAGE_REPO} \ + image_name=${IMAGE_NAME} - name: Create boot.iso - env: - version: "39" - arch: "x86_64" run: | - lorax -p Fedora -v $version -r $version -t Server \ - --isfinal --buildarch=${arch} --volid=Fedora-S-dvd-${arch}-${version} \ - --macboot --noupgrade \ - --repo /etc/yum.repos.d/fedora.repo \ - --repo /etc/yum.repos.d/fedora-updates.repo \ - --add-template ${GITHUB_WORKSPACE}/lorax_templates/set_installer.tmpl \ - --rootfs-size 2 \ - ./results/ + make boot.iso \ + arch=${IMAGE_ARCH} \ + version=${IMAGE_VERSION} \ + image_repo=${IMAGE_REPO} \ + image_name=${IMAGE_NAME} - - name: Generate xorriso input + - name: Create deploy.iso run: | - bash xorriso/gen_input.sh | tee xorriso.txt - - - name: Add additional files to ISO - run: | - xorriso -dialog on < xorriso.txt + make deploy.iso \ + arch=${IMAGE_ARCH} \ + version=${IMAGE_VERSION} \ + image_repo=${IMAGE_REPO} \ + image_name=${IMAGE_NAME} - name: Upload ISO as artifact uses: actions/upload-artifact@v4 with: name: ISOs - path: results/images/deploy.iso + path: deploy.iso if-no-files-found: error retention-days: 0 compression-level: 0 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6eb4987 --- /dev/null +++ b/Makefile @@ -0,0 +1,27 @@ +arch = "x86_64" +version = "39" +base_dir = $(shell pwd) +image_repo = "ghcr.io/ublue-os" +image_name = "base-main" + +deploy.iso: boot.iso xorriso/input.txt $(image_name)-$(version) + xorriso -dialog on < xorriso/input.txt + +boot.iso: lorax_templates/set_installer.tmpl + lorax -p Fedora -v $(version) -r $(version) -t Server \ + --isfinal --buildarch=$(arch) --volid=Fedora-S-dvd-$(arch)-$(version) \ + --macboot --noupgrade \ + --repo /etc/yum.repos.d/fedora.repo \ + --repo /etc/yum.repos.d/fedora-updates.repo \ + --add-template $(base_dir)/lorax_templates/set_installer.tmpl \ + --rootfs-size 2 \ + ./results/ + mv results/images/boot.iso $(base_dir)/ + +$(image_name)-$(version): + podman pull $(image_repo)/$(image_name):$(version) + podman save --format oci-dir -o $(image_name)-$(version) $(image_repo)/$(image_name):$(version) + podman rmi $(image_repo/$(image_name):$(version) + +install-deps: + dnf install -y lorax xorriso podman git rpm-ostree diff --git a/lorax_templates/Makefile b/lorax_templates/Makefile new file mode 100644 index 0000000..8607fe5 --- /dev/null +++ b/lorax_templates/Makefile @@ -0,0 +1,4 @@ +%.tmpl: + sed -i 's/@IMAGE_NAME@/$(image_name)' $* + sed -i 's/@IMAGE_REPO@/$(image_repo)' $* + sed -i 's/@VERSION@/$(version)' $* \ No newline at end of file diff --git a/lorax_templates/set_installer.tmpl b/lorax_templates/set_installer.tmpl index a382961..b7a0950 100644 --- a/lorax_templates/set_installer.tmpl +++ b/lorax_templates/set_installer.tmpl @@ -1 +1 @@ -append usr/share/anaconda/interactive-defaults.ks "ostreecontainer --remote='ostree-unverified-image:docker://ghcr.io/ublue-os/base-main:39' --url=/run/install/repo/base-main-39 --transport=oci --no-signature-verification" \ No newline at end of file +append usr/share/anaconda/interactive-defaults.ks "ostreecontainer --remote='ostree-unverified-image:docker://@IMAGE_REPO@/@IMAGE_NAME@:@VERSION@' --url=/run/install/repo/@IMAGE_NAME@-@VERSION@ --transport=oci --no-signature-verification" \ No newline at end of file diff --git a/xorriso/Makefile b/xorriso/Makefile new file mode 100644 index 0000000..7dbdba9 --- /dev/null +++ b/xorriso/Makefile @@ -0,0 +1,4 @@ +input.txt: + sed -i 's/@IMAGE_NAME@/$(image_name)-$(version)/' gen_input.sh + cd $(base_dir) + bash gen_input.sh > input.txt \ No newline at end of file diff --git a/xorriso/gen_input.sh b/xorriso/gen_input.sh index 437f192..bf06031 100644 --- a/xorriso/gen_input.sh +++ b/xorriso/gen_input.sh @@ -1,12 +1,12 @@ #!/bin/bash -echo "-indev $(pwd)/results/images/boot.iso" -echo "-outdev $(pwd)/results/images/deploy.iso" +echo "-indev $(pwd)/boot.iso" +echo "-outdev $(pwd)/deploy.iso" echo "-boot_image any replay" echo "-volid Fedora-S-dvd-x86_64-39" echo "-joliet on" echo "-compliance joliet_long_names" -for file in $(find base-main-39) +for file in $(find @IMAGE_NAME@) do echo "-map $(pwd)/${file} ${file}" echo "-chmod 0444 ${file}"