
name: Build and publish container images

on:
  workflow_dispatch: { }
  push:
    branches:
    - master

jobs:
  build-and-publish:
    runs-on: ubuntu-latest
    container:
      image: catthehacker/ubuntu:act-latest
    steps:
    - name: Check out the repo
      uses: actions/checkout@v3

    - name: Set up QEMU
      uses: docker/setup-qemu-action@v2

    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v2

    - name: Log in to the Container registry
      uses: docker/login-action@v2
      with:
        registry: gitea.jbrumond.me
        username: ${{ secrets.REGISTRY_USER }}
        password: ${{ secrets.REGISTRY_TOKEN }}

    - name: Build Container and publish
      uses: docker/build-push-action@v4
      env:
        # see <https://docs.gitea.com/usage/actions/comparison#dockerbuild-push-actionv4>
        ACTIONS_RUNTIME_TOKEN: ''
      with:
        context: .
        push: true
        tags: |
          gitea.jbrumond.me/doc-utils/docs-web:latest
        platforms: |
          linux/amd64
          linux/arm64
        # linux/riscv64
        # linux/arm/v7
        # linux/arm/v6
        build-args: |
          DOC_UTILS_VERSION=0.2
          NGINX_VERSION=1.25-alpine-slim
