name: Build Bazzite on: schedule: - cron: '40 16 * * 2,5' # 16:40 utc tues thurs pull_request: branches: - testing - unstable paths-ignore: - '**.md' - '**.txt' - 'repo_content/**' - 'spec_files/**' - 'post_install_files/**' - 'press_kit/**' - '.github/workflows/build_iso.yml' push: branches: - testing - unstable paths-ignore: - '**.md' - '**.txt' - 'repo_content/**' - 'spec_files/**' - 'post_install_files/**' - 'press_kit/**' - '.github/workflows/build_iso.yml' merge_group: workflow_dispatch: env: IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} KERNEL_VERSION: 6.8.4-202.fsync concurrency: group: ${{ github.workflow }}-${{ github.ref || github.run_id }} cancel-in-progress: true jobs: push-ghcr: name: Make runs-on: ubuntu-22.04 continue-on-error: false permissions: contents: read packages: write id-token: write strategy: fail-fast: false matrix: base_image_flavor: [main, asus, framework, surface] base_name: [bazzite, bazzite-deck, bazzite-nvidia] base_image_name: [kinoite, silverblue] major_version: [39] include: - major_version: 39 is_latest_version: true is_stable_version: true exclude: - base_name: bazzite-deck base_image_flavor: nvidia - base_name: bazzite-deck base_image_flavor: asus-nvidia - base_name: bazzite-deck base_image_flavor: surface - base_name: bazzite-deck base_image_flavor: surface-nvidia - base_name: bazzite-nvidia base_image_flavor: framework steps: - name: Verify base image uses: EyeCantCU/cosign-action/verify@v0.2.2 with: containers: ${{ matrix.base_image_name }}-${{ matrix.base_image_flavor }} pubkey: https://raw.githubusercontent.com/ublue-os/${{ matrix.base_image_flavor }}/main/cosign.pub # Checkout push-to-registry action GitHub repository - name: Checkout Push to Registry action uses: actions/checkout@v4 - name: Check just syntax uses: ublue-os/just-action@v1 - name: Maximize build space uses: ublue-os/remove-unwanted-software@v6 - name: Matrix Variables run: | echo "AKMODS_FLAVOR=fsync" >> $GITHUB_ENV echo "BASE_IMAGE_NAME=${{ matrix.base_image_name }}" >> $GITHUB_ENV if [[ "${{ matrix.base_image_flavor }}" == "framework" ]]; then echo "BASE_IMAGE_FLAVOR=framework" >> $GITHUB_ENV else echo "BASE_IMAGE_FLAVOR=main" >> $GITHUB_ENV fi if [[ "${{ matrix.base_name }}" == "bazzite-nvidia" ]]; then if [[ "${{ matrix.base_image_flavor }}" == "main" ]]; then echo "IMAGE_FLAVOR=nvidia" >> $GITHUB_ENV else echo "IMAGE_FLAVOR=${{ format('{0}-{1}', matrix.base_image_flavor, 'nvidia') }}" >> $GITHUB_ENV fi else echo "IMAGE_FLAVOR=${{ matrix.base_image_flavor }}" >> $GITHUB_ENV fi - name: Set image name run: | DESKTOP="" if [[ "${{ matrix.base_image_name }}" == "silverblue" ]]; then DESKTOP="-gnome" fi if [[ "${{ matrix.base_name }}" == "bazzite-deck" ]]; then if [[ "${{ matrix.base_image_flavor }}" == "asus" ]]; then echo "IMAGE_NAME=${{ format('{0}{1}', 'bazzite-ally', '${DESKTOP}') }}" >> $GITHUB_ENV elif [[ "${{ matrix.base_image_flavor }}" == "framework" ]]; then echo "IMAGE_NAME=${{ format('{0}{1}', 'bazzite-framegame', '${DESKTOP}') }}" >> $GITHUB_ENV else echo "IMAGE_NAME=${{ format('{0}{1}', 'bazzite-deck', '${DESKTOP}') }}" >> $GITHUB_ENV fi else if [[ "${{ env.IMAGE_FLAVOR }}" == "main" ]]; then echo "IMAGE_NAME=${{ format('{0}{1}', 'bazzite', '${DESKTOP}') }}" >> $GITHUB_ENV else echo "IMAGE_NAME=${{ format('{0}{1}-{2}', 'bazzite', '${DESKTOP}', env.IMAGE_FLAVOR) }}" >> $GITHUB_ENV fi fi - name: Generate tags id: generate-tags shell: bash run: | # Generate a timestamp for creating an image version history TIMESTAMP="$(date +%Y%m%d)" MAJOR_VERSION="${{ matrix.major_version }}" COMMIT_TAGS=() BUILD_TAGS=() # Have tags for tracking builds during pull request SHA_SHORT="${GITHUB_SHA::7}" COMMIT_TAGS+=("pr-${{ github.event.pull_request.number }}-${MAJOR_VERSION}") COMMIT_TAGS+=("${SHA_SHORT}-${MAJOR_VERSION}") if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \ [[ "${{ matrix.is_stable_version }}" == "true" ]]; then COMMIT_TAGS+=("pr-${{ github.event.pull_request.number }}") COMMIT_TAGS+=("${SHA_SHORT}") fi if [[ ${{ github.ref_name }} == "unstable" ]]; then BUILD_TAGS=("${MAJOR_VERSION}-unstable" "${MAJOR_VERSION}-unstable-${TIMESTAMP}") if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \ [[ "${{ matrix.is_stable_version }}" == "true" ]]; then BUILD_TAGS+=("unstable") fi elif [[ ${{ github.ref_name }} == "testing" ]]; then BUILD_TAGS=("${MAJOR_VERSION}-testing" "${MAJOR_VERSION}-testing-${TIMESTAMP}") if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \ [[ "${{ matrix.is_stable_version }}" == "true" ]]; then BUILD_TAGS+=("testing") fi else BUILD_TAGS=("${MAJOR_VERSION}" "${MAJOR_VERSION}-${TIMESTAMP}") BUILD_TAGS+=("${MAJOR_VERSION}-stable" "${MAJOR_VERSION}-stable-${TIMESTAMP}") if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \ [[ "${{ matrix.is_stable_version }}" == "true" ]]; then BUILD_TAGS+=("latest" "stable") fi fi if [[ "${{ github.event_name }}" == "pull_request" ]]; then echo "Generated the following commit tags: " for TAG in "${COMMIT_TAGS[@]}"; do echo "${TAG}" done alias_tags=("${COMMIT_TAGS[@]}") else alias_tags=("${BUILD_TAGS[@]}") fi echo "Generated the following build tags: " for TAG in "${BUILD_TAGS[@]}"; do echo "${TAG}" done echo "alias_tags=${alias_tags[*]}" >> $GITHUB_OUTPUT - name: Get Current Fedora Version id: labels shell: bash run: | set -eo pipefail if [[ "${{ matrix.base_name }}" == "bazzite-nvidia" ]]; then ver=$(skopeo inspect docker://ghcr.io/ublue-os/bazzite-${{ env.IMAGE_FLAVOR }}:${{ matrix.major_version }} | jq -r '.Labels["org.opencontainers.image.version"]') else ver=$(skopeo inspect docker://ghcr.io/ublue-os/${{ matrix.base_image_name }}-${{ env.IMAGE_FLAVOR }}:${{ matrix.major_version }} | jq -r '.Labels["org.opencontainers.image.version"]') fi if [ -z "$ver" ] || [ "null" = "$ver" ]; then echo "inspected image version must not be empty or null" exit 1 fi echo "VERSION=$ver" >> $GITHUB_OUTPUT # Build metadata - name: Image Metadata uses: docker/metadata-action@v5 id: meta with: images: | ${{ env.IMAGE_NAME }} labels: | ostree.linux=${{ env.KERNEL_VERSION }}.fc${{ matrix.major_version }}.x86_64 org.opencontainers.image.title=${{ env.IMAGE_NAME }} org.opencontainers.image.version=${{ steps.labels.outputs.VERSION }} org.opencontainers.image.description=Bazzite is an OCI image that serves as an alternative operating system for the Steam Deck, and a ready-to-game SteamOS-like for desktop computers, living room home theater PCs, and numerous other handheld PCs. io.artifacthub.package.readme-url=https://bazzite.gg/ io.artifacthub.package.logo-url=https://raw.githubusercontent.com/ublue-os/bazzite/main/repo_content/logo.png # Build image using Buildah action - name: Build Image id: build_image uses: redhat-actions/buildah-build@v2 with: containerfiles: | ./Containerfile image: ${{ env.IMAGE_NAME }} tags: | ${{ steps.generate-tags.outputs.alias_tags }} build-args: | IMAGE_NAME=${{ env.IMAGE_NAME }} IMAGE_FLAVOR=${{ env.IMAGE_FLAVOR }} IMAGE_VENDOR=${{ github.repository_owner }} BASE_IMAGE_NAME=${{ matrix.base_image_name }} BASE_IMAGE_FLAVOR=${{ env.BASE_IMAGE_FLAVOR }} FEDORA_MAJOR_VERSION=${{ matrix.major_version }} AKMODS_FLAVOR=${{ env.AKMODS_FLAVOR }} IMAGE_BRANCH=${{ github.ref_name }} labels: ${{ steps.meta.outputs.labels }} oci: false extra-args: | --target=${{ matrix.base_name }} - name: Sign kernel uses: EyeCantCU/kernel-signer@v0.1.3 with: image: ${{ steps.build_image.outputs.image }} privkey: ${{ secrets.AKMOD_PRIVKEY_20230518 }} pubkey: /etc/pki/akmods/certs/akmods-ublue.der tags: ${{ steps.build_image.outputs.tags }} # Workaround bug where capital letters in your GitHub username make it impossible to push to GHCR. # https://github.com/macbre/push-to-ghcr/issues/12 - name: Lowercase Registry id: registry_case uses: ASzc/change-string-case-action@v6 with: string: ${{ env.IMAGE_REGISTRY }} # Push the image to GHCR (Image Registry) - name: Push To GHCR uses: redhat-actions/push-to-registry@v2 id: push if: github.event_name != 'pull_request' env: REGISTRY_USER: ${{ github.actor }} REGISTRY_PASSWORD: ${{ github.token }} with: image: ${{ steps.build_image.outputs.image }} tags: ${{ steps.build_image.outputs.tags }} registry: ${{ steps.registry_case.outputs.lowercase }} username: ${{ env.REGISTRY_USER }} password: ${{ env.REGISTRY_PASSWORD }} extra-args: | --disable-content-trust - name: Sign container image uses: EyeCantCU/cosign-action/sign@v0.2.2 if: github.event_name != 'pull_request' with: containers: ${{ env.IMAGE_NAME }} registry-token: ${{ secrets.GITHUB_TOKEN }} signing-secret: ${{ secrets.SIGNING_SECRET }} tags: ${{ steps.push.outputs.digest }} - name: Echo outputs if: github.event_name != 'pull_request' run: | echo "${{ toJSON(steps.push.outputs) }}" build_iso: name: build iso needs: [push-ghcr] if: github.ref_name == 'testing' # Eventually would be nice for building images in PRs #if: ${{ endsWith(github.event.pull_request.title, '[ISO]') }} uses: ./.github/workflows/build_iso.yml secrets: inherit