add ci with docker images for x86_64 and aarch64 #5
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 and push image | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
env: | |
# Use docker.io for Docker Hub if empty | |
REGISTRY: ghcr.io | |
# github.repository as <account>/<repo> | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
# This is used to complete the identity challenge | |
# with sigstore/fulcio when running outside of PRs. | |
id-token: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# we could crossbuild but it sounds painful | |
- name: Install qemu dependency | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y qemu-user-static | |
- name: Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.IMAGE_NAME }} | |
tags: | | |
type=sha | |
type=ref,event=branch | |
type=ref,event=pr | |
type=ref,event=tag | |
type=schedule | |
- name: Build image | |
id: build-image | |
uses: redhat-actions/buildah-build@v2 | |
with: | |
platforms: linux/amd64, linux/arm64 | |
image: ${{ env.IMAGE_NAME }} | |
tags: ${{ github.ref_name }} ${{ github.sha }} | |
labels: ${{ steps.meta.outputs.labels }} | |
containerfiles: Containerfile | |
- name: Push image | |
id: push-image | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: ${{ steps.build-image.outputs.image }} | |
tags: ${{ steps.build-image.outputs.tags }} | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |