π(catalog:kairos-bundle): Push and PR cannot share the same build worklow #2
Workflow file for this run
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 Kairos bundles | |
on: | |
pull_request: | |
paths: | |
- .github/workflows/pull_request.kairos-bundles.yaml | |
- catalog/kairos-bundles/** | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
find_updated_bundles: | |
name: π List updated bundles | |
runs-on: ubuntu-latest | |
outputs: | |
updated_bundles: ${{ steps.list_bundles.outputs.updated }} | |
steps: | |
- name: β¬οΈ Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
fetch-depth: 0 | |
- name: π List updated bundles | |
id: list_bundles | |
run: | | |
( | |
echo -n 'updated=' | |
git diff --name-only "${FROM}" "${TO}" | grep 'catalog/kairos-bundles/' | cut -d'/' -f3 | sort --unique \ | |
| grep -v README \ | |
| jq --slurp --raw-input '. | split("\n") | map(select(. != ""))' --compact-output | |
) >> "${GITHUB_OUTPUT}" | |
env: | |
FROM: ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} | |
TO: ${{ github.event.pull_request.head.sha }} | |
build_bundle: | |
name: ποΈ Build bundle (${{ matrix.bundle }}) | |
needs: find_updated_bundles | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
bundle: ${{ fromJson(needs.find_updated_bundles.outputs.updated_bundles) }} | |
steps: | |
- name: β¬οΈ Checkout repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
fetch-depth: 0 | |
- name: π οΈ Set up QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 | |
- name: π οΈ Set up Docker Buildx | |
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0 | |
- name: ποΈ Build bundle (${{ matrix.bundle }}) | |
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0 | |
with: | |
annotations: | | |
org.opencontainers.image.title="${{ matrix.bundle }} (kairos bundle)" | |
org.opencontainers.image.source="https://${{ github.repository }}/blob/${{ github.sha }}/catalog/kairos-bundles/${{ matrix.bundle }}" | |
org.opencontainers.image.description="Kairos bundle for ${{ matrix.bundle }}" | |
context: catalog/kairos-bundles/${{ matrix.bundle }} | |
file: catalog/kairos-bundles/${{ matrix.bundle }}/Dockerfile | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
push: false | |
tags: ghcr.io/${{ github.repository_owner }}/kairos-bundles:${{ matrix.bundle }} | |
env: | |
SOURCE_DATE_EPOCH: 0 |