Skip to content

build

build #22

name: build
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
permissions:
# Checkout repository
contents: read
# Push container images
packages: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
image_variant: ['', 'sampledata', 'notls']
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Docker meta
id: meta
if: ${{ github.event_name != 'pull_request' }}
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=edge
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Login to GitHub Container Registry
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image
if: ${{ github.event_name != 'pull_request' }}
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
file: Containerfile
push: true
# fixme: use steps.meta.outputs.tags again
tags: edge${{ matrix.image_variant }}
labels: ${{ steps.meta.outputs.labels }}
build-args: container_variant=${{ matrix.image_variant }}