build multiarch images #18
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: GitHub CI | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
inputs: | |
include_eol: | |
description: 'Build also EOL-ed suites' | |
type: boolean | |
default: false | |
schedule: | |
- cron: 0 0 * * 0 | |
defaults: | |
run: | |
shell: 'bash -Eeuo pipefail -x {0}' | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
env: | |
INCLUDE_EOL: ${{ inputs.include_eol && 'true' || '' }} | |
jobs: | |
generate-jobs: | |
name: Generate Jobs | |
runs-on: ubuntu-latest | |
outputs: | |
codenames: ${{ steps.generate-jobs.outputs.codenames }} | |
steps: | |
- name: Debian Releases Info | |
id: debian | |
uses: vicamo/actions-library/debian-releases@v1 | |
- name: Ubuntu Releases Info | |
id: ubuntu | |
uses: vicamo/actions-library/ubuntu-releases@v1 | |
- id: generate-jobs | |
name: Generate Jobs | |
env: | |
DEBIAN_JSON: ${{ steps.debian.outputs.json }} | |
UBUNTU_JSON: ${{ steps.ubuntu.outputs.json }} | |
run: | | |
disabled_codename='["experimental"]' | |
codenames="$(jq -n -c -M \ | |
--argjson debian "${DEBIAN_JSON}" \ | |
--argjson ubuntu "${UBUNTU_JSON}" \ | |
'$debian + $ubuntu | | |
map(select(.codename as $c | '"${disabled_codename}"' | | |
index($c) == null)) | | |
map({ | |
"distribution":.distribution, | |
"codename":.codename, | |
"suite":.suite, | |
"active":.active, | |
}) | |
')" | |
if [ -z "${INCLUDE_EOL}" ]; then | |
codenames="$(echo "${codenames}" | jq -c -M 'map(select(.active))')" | |
fi | |
echo "::group::Built JSON(codenames)" | |
echo "${codenames}" | jq | |
echo "::endgroup::" | |
echo "codenames=${codenames}" | tee -a "${GITHUB_OUTPUT}" | |
build: | |
needs: generate-jobs | |
strategy: | |
fail-fast: false | |
matrix: | |
include: ${{ fromJson(needs.generate-jobs.outputs.codenames) }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up QEMU | |
run: | | |
echo "deb http://archive.ubuntu.com/ubuntu/ devel main universe" | \ | |
sudo tee /etc/apt/sources.list.d/devel.list | |
sudo apt-get update -q | |
sudo apt-get install -yq binfmt-support qemu-user-static systemd | |
ls -al /proc/sys/fs/binfmt_misc | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: all | |
- name: Login to Docker Hub | |
if: ${{ github.ref_name == 'master' }} | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.username }} | |
password: ${{ secrets.password }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: 'vicamo/buildpack-deps' | |
env: | |
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index | |
- env: | |
DISTRO: ${{ matrix.distribution }} | |
CODENAME: ${{ matrix.codename }} | |
SUITE: ${{ matrix.suite }} | |
ACTIVE: ${{ matrix.active && 'true' || '' }} | |
run: | | |
docker buildx imagetools inspect --raw vicamo/${DISTRO}:${CODENAME} |