diff --git a/.github/workflows/iso.yml b/.github/workflows/build-and-test.yml similarity index 54% rename from .github/workflows/iso.yml rename to .github/workflows/build-and-test.yml index 72e5d1d..fa50268 100644 --- a/.github/workflows/iso.yml +++ b/.github/workflows/build-and-test.yml @@ -17,8 +17,48 @@ env: VARIANT: 'Server' jobs: + build-container: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + jasonn3/build-container-installer + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + + - name: Buildah Build + id: build-image + uses: redhat-actions/buildah-build@v2 + with: + containerfiles: Containerfile + tags: ${{ steps.meta.outputs.tags }} + + - name: Push image + uses: redhat-actions/push-to-registry@v2 + with: + image: ${{ steps.build-image.outputs.image }} + tags: ${{ steps.build-image.outputs.tags }} + registry: ghcr.io/jasonn3 + username: ${{ github.actor }} + password: ${{ github.token }} + + build-and-push-iso: runs-on: ubuntu-latest + needs: + - build-container permissions: contents: read packages: write diff --git a/Dockerfile b/Containerfile similarity index 100% rename from Dockerfile rename to Containerfile diff --git a/Makefile b/Makefile index 8a7df0d..3a433f1 100644 --- a/Makefile +++ b/Makefile @@ -56,8 +56,8 @@ boot.iso: lorax_templates/set_installer.tmpl lorax_templates/configure_upgrades. mv $(_BASE_DIR)/results/images/boot.iso $(_BASE_DIR)/ # Step 3: Download container image -container/$(IMAGE_NAME)-$(IMAGE_TAG): - mkdir container || true +build/container/$(IMAGE_NAME)-$(IMAGE_TAG): + mkdir build/container || true 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) diff --git a/action.yml b/action.yml index 00e9205..352f643 100644 --- a/action.yml +++ b/action.yml @@ -31,13 +31,17 @@ inputs: default: "false" runs: - using: docker - image: 'Dockerfile' - args: - - ARCH=${{ inputs.arch }} - - IMAGE_NAME=${{ inputs.image_name }} - - IMAGE_REPO=${{ inputs.image_repo }} - - VARIANT=${{ inputs.variant }} - - VERSION=${{ inputs.version }} - - IMAGE_TAG=${{ inputs.image_tag || inputs.version }} - - WEB_UI=${{ inputs.web_ui }} + using: composite + steps: + - name: Run docker image + shell: bash + run: | + tag=$( echo ${{ github.ref_name }} | tr '/' ' ' | awk '{ print $1 }' ) + docker run --privileged --volume .:/github/workspace/ ghcr.io/jasonn3/build-container-image:${tag} \ + ARCH=${{ inputs.arch }} \ + IMAGE_NAME=${{ inputs.image_name }} \ + IMAGE_REPO=${{ inputs.image_repo }} \ + VARIANT=${{ inputs.variant }} \ + VERSION=${{ inputs.version }} \ + IMAGE_TAG=${{ inputs.image_tag || inputs.version }} \ + WEB_UI=${{ inputs.web_ui }} diff --git a/entrypoint.sh b/entrypoint.sh index 81d9cdc..ce0025f 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,7 +2,7 @@ set -ex -make container/${IMAGE_NAME}-${IMAGE_TAG} $@ +make build/container/${IMAGE_NAME}-${IMAGE_TAG} $@ make boot.iso $@