feat(actions): run build parallel on multiple runners and build arm natively #880
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: Docker publish | |
on: | |
push: | |
branches: | |
- 'master' | |
pull_request: | |
types: [opened, reopened, synchronize] | |
workflow_dispatch: | |
jobs: | |
list_containers: | |
name: List containers to build | |
runs-on: ubuntu-24.04 | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.MATRIX }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: '0' | |
- name: Generate containers list with parameters | |
id: set-matrix | |
run: | | |
GIT_DIFF_ENABLED=0 | |
if [ '${{ github.event_name }}' = 'push' ] ; then | |
GIT_DIFF_ENABLED=1 | |
GIT_DIFF_BASE='${{ github.event.before }}' | |
GIT_DIFF_HEAD='${{ github.event.after }}' | |
elif [ '${{ github.event_name }}' = 'pull_request' ] ; then | |
GIT_DIFF_ENABLED=1 | |
GIT_DIFF_BASE='${{ github.event.pull_request.base.sha }}' | |
GIT_DIFF_HEAD='${{ github.event.pull_request.head.sha }}' | |
fi | |
{ | |
echo "MATRIX<<9743a66f914cc249efca164485a19c5c" | |
./scripts/grab_props.sh "$GIT_DIFF_ENABLED" "$GIT_DIFF_BASE" "$GIT_DIFF_HEAD" | yq -p yaml -o json -I 0 . | |
echo 9743a66f914cc249efca164485a19c5c | |
} >> "$GITHUB_OUTPUT" | |
build: | |
name: "Build container: ${{ matrix.container }}" | |
needs: list_containers | |
permissions: | |
contents: read | |
packages: write | |
# This is used to complete the identity challenge | |
# with sigstore/fulcio when running outside of PRs. | |
id-token: write | |
if: needs.list_containers.outputs.matrix != '[]' | |
strategy: | |
fail-fast: false | |
matrix: | |
include: ${{ fromJSON(needs.list_containers.outputs.matrix) }} | |
uses: ./.github/workflows/docker-builder-reusable.yml | |
with: | |
context: containers/${{ matrix.container }} | |
file: Dockerfile | |
title: ${{ matrix.container }} | |
description: ${{ matrix.description }} | |
app_version: ${{ matrix.app_version }} | |
revision: ${{ matrix.revision }} | |
platforms: ${{ matrix.platforms }} | |
registry: ghcr.io | |
image_name: ${{ github.repository }}/${{ matrix.container }} | |
secrets: | |
registry_username: ${{ github.actor }} | |
registry_password: ${{ secrets.GITHUB_TOKEN }} |