Build ISO images #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: Build ISO images | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| create-release: | |
| description: "Create GitHub Release" | |
| required: false | |
| default: false | |
| type: boolean | |
| release-tag: | |
| description: "Release tag (e.g., v1.0.0) - required if creating release" | |
| required: false | |
| type: string | |
| env: | |
| IMAGE_NAME: ${{ github.event.repository.name }} | |
| IMAGE_REGISTRY: "ghcr.io/${{ github.repository_owner }}" | |
| DEFAULT_TAG: "latest" | |
| BIB_IMAGE: "quay.io/centos-bootc/bootc-image-builder:latest" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: Build ISO (${{ matrix.variant.name }}) | |
| runs-on: ubuntu-latest-m | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| variant: | |
| - name: "regular" | |
| tag: "latest" | |
| config: "./disk_config/iso-regular.toml" | |
| - name: "nvidia" | |
| tag: "latest-nvidia" | |
| config: "./disk_config/iso-nvidia.toml" | |
| permissions: | |
| contents: write | |
| packages: read | |
| id-token: write | |
| steps: | |
| - name: Prepare environment | |
| run: | | |
| USER_UID=$(id -u) | |
| USER_GID=$(id -g) | |
| echo "IMAGE_REGISTRY=${IMAGE_REGISTRY,,}" >> ${GITHUB_ENV} | |
| echo "IMAGE_NAME=${IMAGE_NAME,,}" >> ${GITHUB_ENV} | |
| echo "USER_UID=${USER_UID}" >> ${GITHUB_ENV} | |
| echo "USER_GID=${USER_GID}" >> ${GITHUB_ENV} | |
| - name: Maximize build space | |
| uses: ublue-os/remove-unwanted-software@cc0becac701cf642c8f0a6613bbdaf5dc36b259e # v9 | |
| with: | |
| remove-codeql: true | |
| - name: Checkout | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
| - name: Build ISO | |
| id: build | |
| uses: osbuild/bootc-image-builder-action@main | |
| with: | |
| builder-image: ${{ env.BIB_IMAGE }} | |
| config-file: ${{ matrix.variant.config }} | |
| image: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.variant.tag }} | |
| chown: ${{ env.USER_UID }}:${{ env.USER_GID }} | |
| types: anaconda-iso | |
| additional-args: --use-librepo=True | |
| - name: Rename ISO for release | |
| id: rename | |
| run: | | |
| ISO_DIR="${{ steps.build.outputs.output-directory }}" | |
| ORIGINAL_ISO=$(find "$ISO_DIR" -name "*.iso" -type f | head -1) | |
| NEW_NAME="${{ env.IMAGE_NAME }}-${{ matrix.variant.name }}.iso" | |
| mv "$ORIGINAL_ISO" "$ISO_DIR/$NEW_NAME" | |
| echo "iso-path=$ISO_DIR/$NEW_NAME" >> $GITHUB_OUTPUT | |
| echo "iso-name=$NEW_NAME" >> $GITHUB_OUTPUT | |
| - name: Upload ISO as artifact | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: ${{ env.IMAGE_NAME }}-${{ matrix.variant.name }}-iso | |
| path: ${{ steps.build.outputs.output-directory }} | |
| if-no-files-found: error | |
| retention-days: 7 | |
| compression-level: 0 | |
| - name: Upload ISO to release | |
| if: inputs.create-release == true && inputs.release-tag != '' | |
| uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2 | |
| with: | |
| tag_name: ${{ inputs.release-tag }} | |
| files: ${{ steps.rename.outputs.iso-path }} | |
| fail_on_unmatched_files: true | |
| generate_release_notes: true |