build-ublue #135
This file contains 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-ublue | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- '**.md' | |
- '**.txt' | |
schedule: | |
- cron: '20 20 * * *' # 8:20pm everyday | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**.md' | |
- '**.txt' | |
env: | |
IMAGE_BASE_NAME: main | |
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} | |
jobs: | |
push-ghcr: | |
name: Build and push image | |
runs-on: ubuntu-22.04 | |
#container: | |
# image: fedora:${{ matrix.image_version }} #quay.io/fedora-ostree-desktops/buildroot | |
# # Privilleged | |
# options: --privileged --platform linux/${{ matrix.arch }} | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
strategy: | |
fail-fast: false | |
matrix: | |
image_name: [silverblue, kinoite, sericea, vauxite, base] | |
arch: [x86_64, arm64] | |
# Change this to the branch's version! | |
version: [39] | |
image_version: [rawhide] | |
steps: | |
# Checkout push-to-registry action GitHub repository | |
- name: Checkout Push to Registry action | |
uses: actions/checkout@v3 | |
# Setup qemu | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Build Docker image | |
run: | | |
docker build --platform linux/${{ matrix.arch }} -t buildroot --build-arg FEDORA_IMAGE_VERSION=${{ matrix.image_version }} --build-arg FEDORA_IMAGE_ARCH=${{ matrix.arch }} --build-arg IMAGE_TYPE=${{ matrix.image_name }} . | |
- name: Build image | |
run: | | |
docker run --privileged --platform linux/${{ matrix.arch }} --name buildroot --volume $PWD:/build_dir buildroot | |
- name: Import image | |
run: | | |
cat fedora-${{ matrix.image_name }}.ociarchive | podman import - fedora-ostree-desktop-${{ matrix.image_name}}:latest-${{ matrix.version }}-${{ matrix.arch }} | |
# 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@v5 | |
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: fedora-ostree-desktop-${{ matrix.image_name}} | |
tags: latest-${{ matrix.version }}-${{ matrix.arch }} | |
registry: ${{ steps.registry_case.outputs.lowercase }} | |
username: ${{ env.REGISTRY_USER }} | |
password: ${{ env.REGISTRY_PASSWORD }} | |
extra-args: | | |
--disable-content-trust |