Skip to content

Update build.yaml

Update build.yaml #122

Workflow file for this run

name: Build and Push Multi-Arch Image
on:
push:
branches:
- main
release:
types:
- published
workflow_dispatch:
env:
REGISTRY_USER: ${{ secrets.QUAY_USER }}
REGISTRY_PASSWORD: ${{ secrets.QUAY_PASSWORD }}
IMAGE_NAME: quay.io/kuadrant/console-plugin
jobs:
build-multiarch:
name: Build and Push Multi-Arch Image
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
arch: [ amd64, arm64v8 ]
install_latest: [ true, false ]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install QEMU for cross-architecture builds
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Install latest buildah
if: matrix.install_latest
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:projectatomic/ppa
sudo apt-get install -y buildah
- name: Create Containerfile
run: |
cat > Containerfile<<EOF
ARG ARCH
FROM docker.io/\${ARCH}/alpine:3.14
RUN echo "hello world"
ENTRYPOINT [ "sh", "-c", "echo -n 'Machine: ' && uname -m && echo -n 'Bits: ' && getconf LONG_BIT && echo 'goodbye world'" ]
EOF
- name: Build Multi-Arch Image
id: build_image_multiarch
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE_NAME }}
tags: |
latest
${{ github.sha }}
arch: ${{ matrix.arch }}
build-args: ARCH=${{ matrix.arch }}
containerfiles: ./Containerfile
- name: Push Multi-Arch Image to Quay.io
uses: redhat-actions/push-to-registry@v2
with:
registry: quay.io
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
image: ${{ env.IMAGE_NAME }}
tags: |
latest
${{ github.sha }}
- name: Print pushed image URLs
run: |
echo "Image pushed to ${{ env.IMAGE_NAME }}:latest and ${{ env.IMAGE_NAME }}:${{ github.sha }}"