Build Live ISOs #165
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
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
| name: Build Live ISOs | |
| on: | |
| workflow_dispatch: | |
| workflow_call: | |
| push: | |
| branches: [testing] | |
| paths: | |
| - installer/** | |
| env: | |
| IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref || github.run_id }}-iso | |
| cancel-in-progress: true | |
| jobs: | |
| build-iso: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| image_name: | |
| - bazzite | |
| - bazzite-nvidia | |
| - bazzite-nvidia-open | |
| - bazzite-gnome | |
| - bazzite-gnome-nvidia | |
| - bazzite-gnome-nvidia-open | |
| - bazzite-deck | |
| - bazzite-deck-gnome | |
| - bazzite-deck-nvidia | |
| - bazzite-deck-nvidia-gnome | |
| steps: | |
| - name: Show disk space | |
| run: sudo df -h | |
| - name: Check if /mnt is there | |
| id: check_mnt | |
| run: | | |
| if sudo mountpoint /mnt; then | |
| echo "mnt_is_there=1" >>$GITHUB_OUTPUT | |
| else | |
| echo "mnt_is_there=0" >>$GITHUB_OUTPUT | |
| fi | |
| - name: Free Disk Space (Ubuntu) | |
| if: ${{ steps.check_mnt.outputs.mnt_is_there == '1' }} | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 | |
| - name: Mount BTRFS for podman storage | |
| if: ${{ steps.check_mnt.outputs.mnt_is_there == '1' }} | |
| uses: ublue-os/container-storage-action@911baca08baf30c8654933e9e9723cb399892140 | |
| with: | |
| target-dir: /var/lib/containers | |
| continue-on-error: true | |
| - name: Checkout Repo | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| submodules: recursive | |
| - name: Set Image Tag | |
| id: generate-tag | |
| shell: bash | |
| run: | | |
| TAG="stable" | |
| if [[ "${{ github.ref_name }}" != "main" ]]; then | |
| TAG="testing" | |
| fi | |
| echo "tag=${TAG}" >> $GITHUB_OUTPUT | |
| - name: Set Flatpaks Directory Shortname | |
| id: generate-flatpak-dir-shortname | |
| shell: bash | |
| run: | | |
| FLATPAK_DIR_SHORTNAME="kde_flatpaks" | |
| if [[ "${{ matrix.image_name }}" =~ "gnome" ]]; then | |
| FLATPAK_DIR_SHORTNAME="gnome_flatpaks" | |
| fi | |
| echo "flatpak-dir-shortname=${FLATPAK_DIR_SHORTNAME}" >> $GITHUB_OUTPUT | |
| # Docker requires lowercase registry references | |
| - name: Lowercase Registry | |
| id: registry_case | |
| uses: ASzc/change-string-case-action@d0603cd0a7dd490be678164909f65c7737470a7f # v6 | |
| with: | |
| string: ${{ env.IMAGE_REGISTRY }} | |
| # - name: Setup Bazzite Repo | |
| # id: setup-bazzite-repo | |
| # shell: bash | |
| # run: | | |
| # curl -Lo ${{ github.workspace }}/bazzite.repo https://copr.fedorainfracloud.org/coprs/ublue-os/bazzite/repo/fedora-${{ matrix.major_version }}/bazzite-org-bazzite-fedora-${{ matrix.major_version }}.repo | |
| # We need this as we use the desktop image as the runtime for | |
| # the livecds. | |
| - name: Obtain non-deck image ref | |
| id: get-nondeck-ref | |
| run: | | |
| ref="${{ matrix.image_name }}" | |
| ref="${ref/-deck/}" | |
| ref="${ref/-nvidia-open/}" | |
| ref="${ref/-nvidia/}" | |
| # Handle naming mismatch: deck uses nvidia-gnome, non-deck uses gnome-nvidia | |
| if [[ "$ref" == "bazzite-nvidia-gnome" ]]; then | |
| ref="bazzite-gnome-nvidia" | |
| fi | |
| echo "ref=${ref}" >> $GITHUB_OUTPUT | |
| - name: Build Container Image | |
| run: | | |
| BASE_IMAGE="${{ steps.registry_case.outputs.lowercase }}/${{ steps.get-nondeck-ref.outputs.ref }}:${{ steps.generate-tag.outputs.tag }}" | |
| INSTALL_IMAGE_PAYLOAD="${{ steps.registry_case.outputs.lowercase }}/${{ matrix.image_name }}:${{ steps.generate-tag.outputs.tag }}" | |
| FLATPAK_DIR_SHORTNAME="${{ steps.generate-flatpak-dir-shortname.outputs.flatpak-dir-shortname }}" | |
| cd installer || exit 1 | |
| sudo podman build \ | |
| --cap-add sys_admin \ | |
| --security-opt label=disable \ | |
| --build-arg BASE_IMAGE="$BASE_IMAGE" \ | |
| --build-arg INSTALL_IMAGE_PAYLOAD="$INSTALL_IMAGE_PAYLOAD" \ | |
| --build-arg FLATPAK_DIR_SHORTNAME="$FLATPAK_DIR_SHORTNAME" \ | |
| -v "$PWD":/src \ | |
| -t localhost/payload:latest . | |
| - name: Build ISOs | |
| uses: Zeglius/titanoboa@revamp-pr | |
| id: build | |
| with: | |
| image-ref: localhost/payload:latest | |
| # TODO (@Zeglius): Remove "liveiso" prefix once this becomes the main ISO | |
| iso-dest: ${{ matrix.image_name }}-${{ steps.generate-tag.outputs.tag }}-live-amd64.iso | |
| - name: Move ISOs to Upload Directory | |
| id: upload-directory | |
| shell: bash | |
| run: | | |
| ISO_UPLOAD_DIR=${{ github.workspace }}/upload | |
| DEST=${ISO_UPLOAD_DIR}/$(basename ${{ steps.build.outputs.iso-dest }}) | |
| mkdir -p ${ISO_UPLOAD_DIR} | |
| mv ${{ steps.build.outputs.iso-dest }} ${DEST} | |
| sha256sum ${DEST} > ${DEST}-CHECKSUM | |
| echo "iso-upload-dir=${ISO_UPLOAD_DIR}" >> $GITHUB_OUTPUT | |
| - name: Upload ISOs and Checksum to Job Artifacts | |
| if: github.ref_name == 'testing' || true | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: ${{ matrix.image_name }}-${{ steps.generate-tag.outputs.tag }}-${{ matrix.major_version}} | |
| path: ${{ steps.upload-directory.outputs.iso-upload-dir }} | |
| if-no-files-found: error | |
| retention-days: 1 | |
| compression-level: 0 | |
| overwrite: true | |
| - name: Upload ISOs and Checksum to R2 | |
| if: github.event_name == 'workflow_dispatch' && github.ref_name == 'main' | |
| shell: bash | |
| env: | |
| RCLONE_CONFIG_R2_TYPE: s3 | |
| RCLONE_CONFIG_R2_PROVIDER: Cloudflare | |
| RCLONE_CONFIG_R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} | |
| RCLONE_CONFIG_R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} | |
| RCLONE_CONFIG_R2_REGION: auto | |
| RCLONE_CONFIG_R2_ENDPOINT: ${{ secrets.R2_ENDPOINT }} | |
| SOURCE_DIR: ${{ steps.upload-directory.outputs.iso-upload-dir }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y rclone | |
| rclone copy $SOURCE_DIR R2:bazzite |