Fedora & CentOS #41
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: Fedora & CentOS | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '13 4 * * *' | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| DRY_RUN: ${{ github.event_name == 'pull_request' && '1' || '' }} | |
| CACHE_IMAGE: ghcr.io/${{ github.repository }}/cache | |
| jobs: | |
| lint: | |
| name: lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install lint dependencies | |
| run: | | |
| sudo apt-get -qq update | |
| sudo apt-get -qq install -y shellcheck yamllint | |
| - name: Lint | |
| run: make lint | |
| generate-matrices: | |
| name: generate-matrices | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| outputs: | |
| build_matrix: ${{ steps.write.outputs.build_matrix }} | |
| manifest_matrix: ${{ steps.write.outputs.manifest_matrix }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Generate matrices | |
| run: | | |
| pip install pyyaml | |
| make matrix | |
| - name: Set matrix outputs | |
| id: write | |
| run: | | |
| echo "build_matrix<<ENDOFBUILDMATRIX" >> "$GITHUB_OUTPUT" | |
| cat .github/matrices/build-matrix.json >> "$GITHUB_OUTPUT" | |
| echo "" >> "$GITHUB_OUTPUT" | |
| echo "ENDOFBUILDMATRIX" >> "$GITHUB_OUTPUT" | |
| echo "manifest_matrix<<ENDOFMANIFESTMATRIX" >> "$GITHUB_OUTPUT" | |
| cat .github/matrices/manifest-matrix.json >> "$GITHUB_OUTPUT" | |
| echo "" >> "$GITHUB_OUTPUT" | |
| echo "ENDOFMANIFESTMATRIX" >> "$GITHUB_OUTPUT" | |
| build-and-push: | |
| name: b-${{ matrix.containerfile }}-${{ matrix.from_tag }}-${{ matrix.arch }} | |
| runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }} | |
| needs: generate-matrices | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.generate-matrices.outputs.build_matrix) }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Buildah | |
| run: | | |
| sudo apt-get -qq update | |
| sudo apt-get -qq install -y buildah | |
| - name: Build and push image | |
| env: | |
| REPO_USERNAME: ${{ secrets.REPO_USERNAME }} | |
| REPO_PASSWORD: ${{ secrets.REPO_PASSWORD }} | |
| CACHE_USERNAME: ${{ github.actor }} | |
| CACHE_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | |
| TO_IMAGE: ${{ matrix.to_image }} | |
| CACHE_IMAGE: ${{ env.CACHE_IMAGE }} | |
| TO_TAG: ${{ matrix.to_tag }} | |
| ARCH: ${{ matrix.arch }} | |
| CONTAINERFILE: ${{ matrix.containerfile }} | |
| FROM_IMAGE: ${{ matrix.from_image }} | |
| FROM_TAG: ${{ matrix.from_tag }} | |
| run: ./build-and-push.sh | |
| generate-manifests: | |
| name: mf-${{ matrix.tag }} | |
| runs-on: ubuntu-latest | |
| needs: [generate-matrices, build-and-push] | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.generate-matrices.outputs.manifest_matrix) }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Buildah | |
| run: | | |
| sudo apt-get -qq update | |
| sudo apt-get -qq install -y buildah | |
| - name: Create and push multi-arch manifest | |
| env: | |
| REPO_USERNAME: ${{ secrets.REPO_USERNAME }} | |
| REPO_PASSWORD: ${{ secrets.REPO_PASSWORD }} | |
| CACHE_USERNAME: ${{ github.actor }} | |
| CACHE_PASSWORD: ${{ secrets.GITHUB_TOKEN }} | |
| IMAGE: ${{ matrix.image }} | |
| TAG: ${{ matrix.tag }} | |
| ARCHES: ${{ matrix.arches }} | |
| CACHE_IMAGE: ${{ env.CACHE_IMAGE }} | |
| run: ./generate-manifests.sh |