Build for CentOS Stream 10 #31
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
| # SPDX-FileCopyrightText: Timothée Ravier <tim@siosm.fr> | |
| # SPDX-License-Identifier: CC0-1.0 | |
| name: "Build buildroot container image for CI" | |
| env: | |
| NAME: "${{ github.event.repository.name }}" | |
| REGISTRY: "ghcr.io/${{ github.repository_owner }}" | |
| on: | |
| pull_request: | |
| branches: | |
| - "main" | |
| paths: | |
| - 'Containerfile' | |
| - '.github/workflows/buildroot.yml' | |
| push: | |
| branches: | |
| - "main" | |
| paths: | |
| - 'Containerfile' | |
| - '.github/workflows/buildroot.yml' | |
| schedule: | |
| - cron: '0 0 * * MON' | |
| workflow_dispatch: | |
| # Allow: | |
| # - Read access to the repo content | |
| # - Write access to packages to allow access to GitHub container registry | |
| permissions: | |
| contents: read | |
| packages: write | |
| # Prevent multiple workflow runs from racing to ensure that pushes are made | |
| # sequentialy for the main branch. Also cancel in progress workflow runs. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| matrix: | |
| include: | |
| - tag: fedora | |
| base: quay.io/fedora/fedora:latest | |
| arch: x86_64 | |
| runner: ubuntu-24.04 | |
| - tag: fedora | |
| base: quay.io/fedora/fedora:latest | |
| arch: aarch64 | |
| runner: ubuntu-24.04-arm | |
| - tag: centos-stream | |
| base: quay.io/centos/centos:stream10 | |
| arch: x86_64 | |
| runner: ubuntu-24.04 | |
| - tag: centos-stream | |
| base: quay.io/centos/centos:stream10 | |
| arch: aarch64 | |
| runner: ubuntu-24.04-arm | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v5 | |
| - name: Build container image | |
| uses: redhat-actions/buildah-build@v2 | |
| with: | |
| context: .github | |
| image: ${{ env.NAME }} | |
| tags: ${{ matrix.tag }}-${{ matrix.arch }} | |
| containerfiles: Containerfile | |
| oci: true | |
| build-args: | | |
| BASE=${{ matrix.base }} | |
| - name: Push to Container Registry | |
| uses: redhat-actions/push-to-registry@v2 | |
| id: push | |
| if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main' | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| image: ${{ env.NAME }} | |
| tags: ${{ matrix.tag }}-${{ matrix.arch }} | |
| merge: | |
| runs-on: ubuntu-24.04 | |
| needs: | |
| - build | |
| strategy: | |
| matrix: | |
| tag: [fedora, centos-stream] | |
| steps: | |
| - name: Create multi-arch manifest | |
| if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main' | |
| shell: bash | |
| run: | | |
| set -euxo pipefail | |
| buildah manifest create "${REGISTRY}/${NAME}:${{ matrix.tag }}" \ | |
| "${REGISTRY}/${NAME}:${{ matrix.tag }}-x86_64" \ | |
| "${REGISTRY}/${NAME}:${{ matrix.tag }}-aarch64" | |
| - name: Push to Container Registry | |
| uses: redhat-actions/push-to-registry@v2 | |
| id: push | |
| if: (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main' | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| image: ${{ env.NAME }} | |
| tags: ${{ matrix.tag }} |