diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..babf01e --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,16 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile +{ + "name": "Existing Dockerfile", + // "build": { + // "context": "..", + // "dockerfile": "../Containerfile", + // "args": { + // "version": "39" + // } + // }, + "image": "ghcr.io/ublue-os/isogenerator:latest", + "overrideCommand": true, + "shutdownAction": "stopContainer", + "privileged": true +} diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..d446188 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# Default owner of code within this repo +* @JasonN3 \ No newline at end of file diff --git a/.github/workflows/build-container-image.yml b/.github/workflows/build-container-image.yml new file mode 100644 index 0000000..0c17baa --- /dev/null +++ b/.github/workflows/build-container-image.yml @@ -0,0 +1,52 @@ +--- +name: Build Container Image +on: + pull_request: + branches: + - main + push: + branches: + - main + +jobs: + push-image: + name: Build and push container image + runs-on: ubuntu-22.04 + permissions: + contents: read + packages: write + strategy: + fail-fast: false + matrix: + version: + - 38 + - 39 + - 40 + include: + - version: 39 + support: latest + steps: + - name: Build image + uses: ublue-os/build-action@1.0.1 + with: + image_name: isogenerator + image_variant: main + version: ${{ matrix.version }} + support: ${{ matrix.support }} + signing_key: ${{ secrets.SIGNING_SECRET }} + continue-on-error: false + + check: + name: Check build successful + if: ${{ !cancelled() }} + runs-on: ubuntu-latest + needs: + - push-image + steps: + - name: Exit on failure for main + if: ${{ needs.push-image.result == 'failure' || needs.push-image.result == 'skipped' }} + shell: bash + run: exit 1 + - name: Exit + shell: bash + run: exit 0 \ No newline at end of file diff --git a/.github/workflows/iso.yml b/.github/workflows/iso.yml deleted file mode 100644 index a3de020..0000000 --- a/.github/workflows/iso.yml +++ /dev/null @@ -1,87 +0,0 @@ -name: Create and publish an ISO - -on: - push: - branches: - - 'main' - tags: - - 'v*' - pull_request: - workflow_dispatch: - - workflow_call: - inputs: - ARCH: - required: true - type: string - IMAGE_NAME: - required: true - type: string - IMAGE_REPO: - required: true - type: string - IMAGE_TAG: - required: true - type: string - VARIANT: - required: true - type: string - VERSION: - required: true - type: string - WEB_UI: - required: true - type: string - BUILD_REPO: - required: false - type: string - default: ublue-os/isogenerator - BUILD_REF: - required: false - type: string - default: main - -env: - ARCH: ${{ inputs.ARCH || 'x86_64' }} - IMAGE_NAME: ${{ inputs.IMAGE_NAME || 'base-main' }} - IMAGE_REPO: ${{ inputs.IMAGE_REPO || 'ghcr.io/ublue-os' }} - IMAGE_TAG: ${{ inputs.IMAGE_TAG || 'latest' }} - VARIANT: ${{ inputs.VARIANT || 'Kinoite' }} - VERSION: ${{ inputs.VERSION || '39' }} - WEB_UI: ${{ inputs.WEB_UI || 'false' }} - CURR_REPO: ${{ inputs.BUILD_REPO || github.repository }} - CURR_REF: ${{ inputs.BUILD_REF || github.ref }} - -jobs: - build-and-push-iso: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Build ISO - shell: bash - run: | - set -eo pipefail - mkdir -p output - docker run \ - --rm --privileged \ - -v ./output:/isogenerator/output \ - -e ARCH="${{ env.ARCH }}" \ - -e IMAGE_NAME="${{ env.IMAGE_NAME }}" \ - -e IMAGE_REPO="${{ env.IMAGE_REPO }}" \ - -e IMAGE_TAG="${{ env.IMAGE_TAG }}" \ - -e VARIANT="${{ env.VARIANT }}" \ - -e VERSION="${{ env.VERSION }}" \ - -e WEB_UI="${{ env.WEB_UI }}" \ - ghcr.io/ublue-os/isogenerator:latest - - - name: Upload ISO as artifact - uses: actions/upload-artifact@v4 - with: - name: ${{ env.IMAGE_NAME }}-${{ env.IMAGE_TAG }}.iso - path: output/*.iso - if-no-files-found: error - retention-days: 0 - compression-level: 0 - overwrite: true diff --git a/.github/workflows/isogenerator-image.yml b/.github/workflows/isogenerator-image.yml deleted file mode 100644 index c6be3ba..0000000 --- a/.github/workflows/isogenerator-image.yml +++ /dev/null @@ -1,84 +0,0 @@ ---- -name: isogenerator-image -on: - pull_request: - branches: - - main - paths: - - 'Dockerfile' - push: - branches: - - main - paths: - - 'Dockerfile' - workflow_dispatch: - -env: - IMAGE_NAME: isogenerator - IMAGE_REGISTRY: "ghcr.io/${{ github.repository_owner }}" - -jobs: - push-image: - name: Build and push image - runs-on: ubuntu-22.04 - - permissions: - contents: read - packages: write - id-token: write - - strategy: - fail-fast: false - - steps: - # Checkout push-to-registry action GitHub repository - - name: Checkout Push to Registry action - uses: actions/checkout@v3 - - # Build metadata - - name: Image Metadata - uses: docker/metadata-action@v4 - id: meta - with: - images: | - ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }} - - labels: | - io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/main/README.md - org.opencontainers.image.description=A container image for generating Universal Blue ISO files - org.opencontainers.image.title=${{ env.IMAGE_NAME }} - tags: | - type=ref,event=branch - type=ref,event=pr - # set latest tag for default branch - type=raw,value=latest,enable={{is_default_branch}} - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and Push Image - uses: docker/build-push-action@v4 - with: - context: ./ - file: ./Dockerfile - push: ${{ github.event_name != 'pull_request' }} - labels: ${{ steps.meta.outputs.labels }} - tags: ${{ steps.meta.outputs.tags }} - - check: - name: Check build successful - if: ${{ !cancelled() }} - runs-on: ubuntu-latest - needs: [push-image] - steps: - - name: Exit on failure - if: ${{ needs.push-image.result == 'failure' || needs.push-image.result == 'skipped' }} - shell: bash - run: exit 1 - - name: Exit - shell: bash - run: exit 0 diff --git a/.github/workflows/test-iso.yml b/.github/workflows/test-iso.yml new file mode 100644 index 0000000..0465b1b --- /dev/null +++ b/.github/workflows/test-iso.yml @@ -0,0 +1,58 @@ +name: Test Generate ISO + +on: + merge_group: + pull_request: + branches: + - main + paths-ignore: + - 'Containerfile' + - '*.md' + - 'LICENSE' + - 'CODEOWNERS' + +jobs: + build-and-push-iso: + name: Build ISO + runs-on: ubuntu-latest + container: + image: fedora:39 + options: "--privileged" + permissions: + contents: read + packages: write + strategy: + fail-fast: false + matrix: + version: + - 38 + - 39 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Build ISO + uses: ./ + with: + ARCH: 'x86_64' + IMAGE_NAME: 'base-main' + IMAGE_REPO: 'ghcr.io/ublue-os' + VARIANT: 'Kinoite' + VERSION: ${{ matrix.version }} + ACTION_REPO: ${{ github.repository }} + ACTION_REF: ${{ github.ref }} + + check: + name: Check build successful + if: ${{ !cancelled() }} + runs-on: ubuntu-latest + needs: + - build-and-push-iso + steps: + - name: Exit on failure for main + if: ${{ needs.build-and-push-iso.result == 'failure' || needs.build-and-push-iso.result == 'skipped' }} + shell: bash + run: exit 1 + - name: Exit + shell: bash + run: exit 0 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 03894b9..23d7903 100644 --- a/.gitignore +++ b/.gitignore @@ -8,5 +8,5 @@ /original-pkgsizes.txt /final-pkgsizes.txt /lorax.conf -/*.iso +/output /*.log \ No newline at end of file diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..e5f3d74 --- /dev/null +++ b/Containerfile @@ -0,0 +1,21 @@ +ARG VERSION=39 + +FROM fedora:${VERSION} + +ENV ARCH="x86_64" +ENV IMAGE_NAME="base-main" +ENV IMAGE_REPO="ghcr.io/ublue-os" +ENV IMAGE_TAG="${VERSION}" +ENV VARIANT="Kinoite" +ENV VERSION="${VERSION}" +ENV WEB_UI="false" + +COPY / /isogenerator +WORKDIR /isogenerator + +RUN dnf install -y make && make install-deps + +VOLUME /isogenerator/output + +ENTRYPOINT ["make", "output/${IMAGE_NAME}-${IMAGE_TAG}.iso"] +CMD [ "ARCH=${ARCH}", "VERSION=${VERSION}", "IMAGE_REPO=${IMAGE_REPO}", "IMAGE_NAME=${IMAGE_NAME}", "IMAGE_TAG=${IMAGE_TAG}", "VARIANT=${VARIANT}", "WEB_UI=${WEB_UI}"] diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 652cbd1..0000000 --- a/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM fedora:latest - -ENV ARCH="x86_64" -ENV IMAGE_NAME="base-main" -ENV IMAGE_REPO="ghcr.io/ublue-os" -ENV IMAGE_TAG="$(version)" -ENV VARIANT="Kinoite" -ENV VERSION="39" -ENV WEB_UI="false" - -WORKDIR /isogenerator - -RUN dnf install -y make git && \ - git clone https://github.com/ublue-os/isogenerator.git . && \ - make install-deps - - -ENTRYPOINT ["make", "arch=${ARCH}", "version=${VERSION}", "image_repo=${IMAGE_REPO}", "image_name=${IMAGE_NAME}", "image_tag=${IMAGE_TAG}", "variant=${VARIANT}", "web_ui=${WEB_UI}"] diff --git a/Makefile b/Makefile index 317f774..b189d20 100644 --- a/Makefile +++ b/Makefile @@ -1,85 +1,98 @@ -arch = x86_64 -version = 39 -base_dir = $(shell pwd) -image_repo = ghcr.io/ublue-os -image_name = base-main -image_tag = $(version) -variant = Silverblue -web_ui = false +# Configuration vars +## Formatting = UPPERCASE +ARCH = x86_64 +VERSION = 39 +IMAGE_REPO = ghcr.io/ublue-os +IMAGE_NAME = base-main +IMAGE_TAG = $(version) +VARIANT = Kinoite +WEB_UI = false -image_repo_escaped = $(subst /,\/,$(image_repo)) -image_repo_double_escaped = $(subst \,\\\,$(image_repo_escaped)) +# Generated vars +## Formatting = _UPPERCASE +_BASE_DIR = $(shell pwd) +_IMAGE_REPO_ESCAPED = $(subst /,\/,$(IMAGE_REPO)) +_IMAGE_REPO_DOUBLE_ESCAPED = $(subst \,\\\,$(_IMAGE_REPO_ESCAPED)) -ifeq ($(variant),'Server') -lorax_args = --macboot --noupgrade +ifeq ($(VARIANT),'Server') +_LORAX_ARGS = --macboot --noupgrade else -lorax_args = --nomacboot +_LORAX_ARGS = --nomacboot endif -ifeq ($(web_ui),true) -lorax_args += -i anaconda-webui +ifeq ($(WEB_UI),true) +_LORAX_ARGS += -i anaconda-webui endif -$(image_name)-$(version).iso: boot.iso container/$(image_name)-$(image_tag) xorriso/input.txt - xorriso -dialog on < $(base_dir)/xorriso/input.txt +# Step 7: Move end ISO to root +## Default action +$(IMAGE_NAME)-$(IMAGE_TAG).iso: output/$(IMAGE_NAME)-$(IMAGE_TAG).iso + mv output/$(IMAGE_NAME)-$(IMAGE_TAG).iso $(IMAGE_NAME)-$(IMAGE_TAG).iso +# Step 6: Build end ISO file +output/$(IMAGE_NAME)-$(IMAGE_TAG).iso: boot.iso container/$(IMAGE_NAME)-$(IMAGE_TAG) xorriso/input.txt + mkdir $(_BASE_DIR)/output + xorriso -dialog on < $(_BASE_DIR)/xorriso/input.txt + +# Step 1: Generate Lorax Templates +lorax_templates/%.tmpl: lorax_templates/%.tmpl.in + sed 's/@IMAGE_NAME@/$(IMAGE_NAME)/' $(_BASE_DIR)/lorax_templates/$*.tmpl.in > $(_BASE_DIR)/lorax_templates/$*.tmpl + + sed 's/@IMAGE_TAG@/$(IMAGE_TAG)/' $(_BASE_DIR)/lorax_templates/$*.tmpl > $(_BASE_DIR)/lorax_templates/$*.tmpl.tmp + mv $(_BASE_DIR)/lorax_templates/$*.tmpl{.tmp,} + + sed 's/@IMAGE_REPO_ESCAPED@/$(_IMAGE_REPO_DOUBLE_ESCAPED)/' $(_BASE_DIR)/lorax_templates/$*.tmpl > $(_BASE_DIR)/lorax_templates/$*.tmpl.tmp + mv $(_BASE_DIR)/lorax_templates/$*.tmpl{.tmp,} + +# Step 2: Build boot.iso using Lorax boot.iso: lorax_templates/set_installer.tmpl lorax_templates/configure_upgrades.tmpl - rm -Rf $(base_dir)/results - lorax -p $(image_name) -v $(version) -r $(version) -t $(variant) \ - --isfinal --buildarch=$(arch) --volid=$(image_name)-$(arch)-$(version) \ - $(lorax_args) \ + rm -Rf $(_BASE_DIR)/results + lorax -p $(IMAGE_NAME) -v $(VERSION) -r $(VERSION) -t $(VARIANT) \ + --isfinal --buildarch=$(ARCH) --volid=$(IMAGE_NAME)-$(ARCH)-$(VERSION) \ + $(_LORAX_ARGS) \ --repo /etc/yum.repos.d/fedora.repo \ --repo /etc/yum.repos.d/fedora-updates.repo \ - --add-template $(base_dir)/lorax_templates/set_installer.tmpl \ - --add-template $(base_dir)/lorax_templates/configure_upgrades.tmpl \ - $(base_dir)/results/ - mv $(base_dir)/results/images/boot.iso $(base_dir)/ + --add-template $(_BASE_DIR)/lorax_templates/set_installer.tmpl \ + --add-template $(_BASE_DIR)/lorax_templates/configure_upgrades.tmpl \ + $(_BASE_DIR)/results/ + mv $(_BASE_DIR)/results/images/boot.iso $(_BASE_DIR)/ -container/$(image_name)-$(image_tag): +# Step 3: Download container image +container/$(IMAGE_NAME)-$(IMAGE_TAG): mkdir container - podman pull $(image_repo)/$(image_name):$(image_tag) - podman save --format oci-dir -o $(base_dir)/container/$(image_name)-$(image_tag) $(image_repo)/$(image_name):$(image_tag) - podman rmi $(image_repo)/$(image_name):$(image_tag) + podman pull $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) + podman save --format oci-dir -o $(_BASE_DIR)/container/$(IMAGE_NAME)-$(IMAGE_TAG) $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) + podman rmi $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) install-deps: dnf install -y lorax xorriso podman git rpm-ostree - - -lorax_templates/%.tmpl: lorax_templates/%.tmpl.in - sed 's/@IMAGE_NAME@/$(image_name)/' $(base_dir)/lorax_templates/$*.tmpl.in > $(base_dir)/lorax_templates/$*.tmpl - sed 's/@IMAGE_REPO@/$(image_repo_escaped)/' $(base_dir)/lorax_templates/$*.tmpl > $(base_dir)/lorax_templates/$*.tmpl.tmp - mv $(base_dir)/lorax_templates/$*.tmpl{.tmp,} - sed 's/@IMAGE_TAG@/$(image_tag)/' $(base_dir)/lorax_templates/$*.tmpl > $(base_dir)/lorax_templates/$*.tmpl.tmp - mv $(base_dir)/lorax_templates/$*.tmpl{.tmp,} - sed 's/@IMAGE_REPO_ESCAPED@/$(image_repo_double_escaped)/' $(base_dir)/lorax_templates/$*.tmpl > $(base_dir)/lorax_templates/$*.tmpl.tmp - mv $(base_dir)/lorax_templates/$*.tmpl{.tmp,} - - - -xorriso/input.txt: xorriso/gen_input.sh - bash $(base_dir)/xorriso/gen_input.sh | tee $(base_dir)/xorriso/input.txt - +# Step 4: Generate xorriso script xorriso/%.sh: xorriso/%.sh.in - sed 's/@IMAGE_NAME@/$(image_name)/' $(base_dir)/xorriso/$*.sh.in > $(base_dir)/xorriso/$*.sh.in2 - sed 's/@IMAGE_TAG@/$(image_tag)/' $(base_dir)/xorriso/$*.sh.in2 > $(base_dir)/xorriso/$*.sh - sed 's/@VERSION@/$(version)/' $(base_dir)/xorriso/$*.sh > $(base_dir)/xorriso/$*.sh.tmp - mv $(base_dir)/xorriso/$*.sh{.tmp,} - sed 's/@ARCH@/$(arch)/' $(base_dir)/xorriso/$*.sh > $(base_dir)/xorriso/$*.sh.tmp - mv $(base_dir)/xorriso/$*.sh{.tmp,} + sed 's/@IMAGE_NAME@/$(IMAGE_NAME)/' $(_BASE_DIR)/xorriso/$*.sh.in > $(_BASE_DIR)/xorriso/$*.sh + + sed 's/@IMAGE_TAG@/$(IMAGE_TAG)/' $(_BASE_DIR)/xorriso/$*.sh > $(_BASE_DIR)/xorriso/$*.sh.tmp + mv $(_BASE_DIR)/xorriso/$*.sh{.tmp,} + + sed 's/@ARCH@/$(ARCH)/' $(_BASE_DIR)/xorriso/$*.sh > $(_BASE_DIR)/xorriso/$*.sh.tmp + mv $(_BASE_DIR)/xorriso/$*.sh{.tmp,} + +# Step 5: Generate xorriso input +xorriso/input.txt: xorriso/gen_input.sh + bash $(_BASE_DIR)/xorriso/gen_input.sh | tee $(_BASE_DIR)/xorriso/input.txt clean: - rm -Rf $(base_dir)/container || true - rm -Rf $(base_dir)/debugdata || true - rm -Rf $(base_dir)/pkglists || true - rm -Rf $(base_dir)/results || true - rm -f $(base_dir)/lorax_templates/*.tmpl || true - rm -f $(base_dir)/xorriso/input.txt || true - rm -f $(base_dir)/xorriso/*.sh || true - rm -f $(base_dir)/{original,final}-pkgsizes.txt || true - rm -f $(base_dir)/lorax.conf || true - rm -f $(base_dir)/*.iso || true - rm -f $(base_dir)/*.log || true - + rm -Rf $(_BASE_DIR)/container || true + rm -Rf $(_BASE_DIR)/debugdata || true + rm -Rf $(_BASE_DIR)/pkglists || true + rm -Rf $(_BASE_DIR)/results || true + rm -f $(_BASE_DIR)/lorax_templates/*.tmpl || true + rm -f $(_BASE_DIR)/xorriso/input.txt || true + rm -f $(_BASE_DIR)/xorriso/*.sh || true + rm -f $(_BASE_DIR)/{original,final}-pkgsizes.txt || true + rm -f $(_BASE_DIR)/lorax.conf || true + rm -f $(_BASE_DIR)/*.iso || true + rm -f $(_BASE_DIR)/*.log || true +.PHONY: clean diff --git a/README.md b/README.md index 8d1402b..b3575d0 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,93 @@ -# container-installer -Creates an ISO for installing a container image as an OS +# UBlueOS ISO Generator +This action is used to generate the ISO images for UBlueOS. + + +## Makefile +A Makefile is provided for ease of use. There are separate targets for each file generated, however `make` can be used to generate the final image and `make clean` can be used to clean up the workspace. + +See [Customizing](#customizing) for information about customizing the image that gets created. + +## Container +A container with the necessary tools already installed is provided at `ghcr.io/ublue-os/isogenerator:latest` + +To use the container file, run `docker --privileged --volume .:/isogenerator/output ghcr.io/ublue-os/isogenerator` + +See [Customizing](#customizing) for information about customizing the image that gets created. The variable can either be defined as environment variables or as command arguments. +Examples: +Environment Variable +```bash +docker --privileged --volume .:/isogenerator/output -e VERSION=39 ghcr.io/ublue-os/isogenerator +``` +Command Argument +```bash +docker --privileged --volume .:/isogenerator/output ghcr.io/ublue-os/isogenerator VERSION=39 +``` + +## Customizing +The following variables can be used to customize the create image. + +- ARCH + Architecture for image to build + Default Value: x86_64 +- VERSION + Fedora version of installer to build + Default Value: 39 +- IMAGE_REPO + Repository containing the source container image + Default Value: ghcr.io/ublue-os +- IMAGE_NAME + Name of the source container image + Default Value: base-main +- IMAGE_TAG + Tag of the source container image + Default Value: *VERSION* +- VARIANT + Source container variant + Available options can be found by running `dnf provides system-release`. Variant will be the third item in the package name. Example: `fedora-release-kinoite-39-34.noarch` will be kinonite + Default Value: Silverblue +- WEB_UI + Enable Anaconda WebUI + Default Value: false + +## VSCode Dev Container +There is a dev container configuration provided for development. By default it will use the existing container image available at `ghcr.io/ublue-os/isogenerator`, however, you can have it build a new image by editing `.devcontainer/devcontainer.json` and replacing `image` with `build`. `Ctrl+/` can be used to comment and uncomment blocks of code within VSCode. + +The code from VSCode will be available at `/workspaces/isogenerator` once the container has started. + +Privileged is required for access to loop devices for lorax. + +Use existing image +```json +{ + "name": "Existing Dockerfile", + // "build": { + // "context": "..", + // "dockerfile": "../Containerfile", + // "args": { + // "version": "39" + // } + // }, + "image": "ghcr.io/ublue-os/isogenerator:latest", + "overrideCommand": true, + "shutdownAction": "stopContainer", + "privileged": true +} +``` + +Build a new image +```json +{ + "name": "Existing Dockerfile", + "build": { + "context": "..", + "dockerfile": "../Containerfile", + "args": { + "version": "39" + } + }, + //"image": "ghcr.io/ublue-os/isogenerator:latest", + "overrideCommand": true, + "shutdownAction": "stopContainer", + "privileged": true +} +``` diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..c08f1ee --- /dev/null +++ b/action.yml @@ -0,0 +1,130 @@ +name: Generate ISO +description: Creates an ISO for installing an OSTree container + +inputs: + ARCH: + description: Architecture for image to build + required: true + default: x86_64 + IMAGE_NAME: + description: Name of the source container image + required: true + default: base-main + IMAGE_REPO: + description: Repository containing the source container image + required: true + default: ghcr.io/ublue-os + VARIANT: + description: "Source container variant. Available options can be found by running `dnf provides system-release`. Variant will be the third item in the package name. Example: `fedora-release-kinoite-39-34.noarch` will be kinonite" + required: true + default: Kinoite + VERSION: + description: Fedora version of installer to build + required: true + default: "39" + IMAGE_TAG: + description: Tag of the source container image + required: false + WEB_UI: + description: Enable Anaconda WebUI + required: true + default: "false" + ACTION_REPO: + description: Repository with the build action + required: false + default: ${{ github.repository }} + ACTION_REF: + description: Repository ref for the build action + required: false + default: ${{ github.ref }} + +runs: + using: composite + steps: + - name: Cleanup host + shell: bash + run: | + if [[ -d /host ]] + then + df -h /host + # Remove Android Library + rm -Rf /host/usr/local/lib/android + # Remove .NET runtime + rm -Rf /host/usr/share/dotnet + # Remove Haskell runtime + rm -rf /host/opt/ghc + rm -rf /host/usr/local/.ghcup + chroot /host docker image prune --all --force + df -h /host + else + echo "Host must be mounted as /host in order to make more space" + fi + + - name: Install make and git + shell: bash + run: dnf install -y make git + + - name: Checkout repository + uses: actions/checkout@v4 + with: + repository: ${{ inputs.ACTION_REPO }} + ref: ${{ inputs.ACTION_REF }} + submodules: recursive + + - name: Install dependencies + shell: bash + run: make install-deps + + - name: Lowercase Registry + id: registry_case + uses: ASzc/change-string-case-action@v6 + with: + string: ${{ inputs.IMAGE_REPO }} + + - name: Download image + shell: bash + run: | + make container/${{ inputs.IMAGE_NAME }}-${{ inputs.IMAGE_TAG || inputs.VERSION }} \ + ARCH=${{ inputs.ARCH }} \ + IMAGE_NAME=${{ inputs.IMAGE_NAME }} \ + IMAGE_REPO=${{ steps.registry_case.outputs.lowercase }} \ + IMAGE_TAG=${{ inputs.IMAGE_TAG || inputs.VERSION }} \ + VARIANT=${{ inputs.VARIANT }} \ + VERSION=${{ inputs.VERSION }} \ + WEB_UI=${{ inputs.WEB_UI }} + + - name: Create boot.iso + shell: bash + run: | + make boot.iso \ + ARCH=${{ inputs.ARCH }} \ + IMAGE_NAME=${{ inputs.IMAGE_NAME }} \ + IMAGE_REPO=${{ steps.registry_case.outputs.lowercase }} \ + IMAGE_TAG=${{ inputs.IMAGE_TAG || inputs.VERSION }} \ + VARIANT=${{ inputs.VARIANT }} \ + VERSION=${{ inputs.VERSION }} \ + WEB_UI=${{ inputs.WEB_UI }} + + - name: Create deploy.iso + shell: bash + run: | + make ${{ inputs.IMAGE_NAME }}-${{ inputs.IMAGE_TAG || inputs.VERSION }}.iso \ + ARCH=${{ inputs.ARCH }} \ + IMAGE_NAME=${{ inputs.IMAGE_NAME }} \ + IMAGE_REPO=${{ steps.registry_case.outputs.lowercase }} \ + IMAGE_TAG=${{ inputs.IMAGE_TAG || inputs.VERSION }} \ + VARIANT=${{ inputs.VARIANT }} \ + VERSION=${{ inputs.VERSION }} \ + WEB_UI=${{ inputs.WEB_UI }} + mkdir end_iso + mv ${{ inputs.IMAGE_NAME }}-${{ inputs.IMAGE_TAG || inputs.VERSION }}.iso end_iso/ + + - name: Upload ISO as artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ inputs.IMAGE_NAME }}-${{ inputs.IMAGE_TAG || inputs.VERSION }}-${{ inputs.VARIANT }}.iso + path: end_iso/*.iso + if-no-files-found: error + retention-days: 0 + compression-level: 0 + overwrite: true diff --git a/output/README.md b/output/README.md deleted file mode 100644 index fc50ae3..0000000 --- a/output/README.md +++ /dev/null @@ -1 +0,0 @@ -Final ISO gets output in this directory diff --git a/xorriso/gen_input.sh.in b/xorriso/gen_input.sh.in index 299cfc3..30d73fa 100644 --- a/xorriso/gen_input.sh.in +++ b/xorriso/gen_input.sh.in @@ -1,9 +1,9 @@ #!/bin/bash echo "-indev $(pwd)/boot.iso" -echo "-outdev $(pwd)/output/@IMAGE_NAME@-@VERSION@.iso" +echo "-outdev $(pwd)/output/@IMAGE_NAME@-@IMAGE_TAG@.iso" echo "-boot_image any replay" -echo "-volid @IMAGE_NAME@-@ARCH@-@VERSION@" +echo "-volid @IMAGE_NAME@-@ARCH@-@IMAGE_TAG@" echo "-joliet on" echo "-compliance joliet_long_names" cd container