Skip to content

Build

Build #105

Workflow file for this run

name: Build
# Controls when the workflow will run
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 23 * * 0'
push:
branches:
- 'main'
- 'dev'
- 'multiarch'
tags:
- 'v*.*.*'
pull_request:
branches:
- 'main'
- 'dev'
- 'multiarch'
# permissions are needed if pushing to ghcr.io
permissions:
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
# Get the repository's code
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Docker meta
id: dmeta # you'll use this in the next step
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
quay.io/wbh-community/wbhdoc
# Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm/v8
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.dmeta.outputs.tags }}
labels: ${{ steps.dmeta.outputs.labels }}