Skip to content

11.0.236

11.0.236 #42

Workflow file for this run

name: Docker GHCR publish
on:
workflow_dispatch:
inputs:
ref_name:
description: Release version tag (e.g. v1.2.3)
required: true
release:
description: Push images to GHCR
required: false
type: boolean
default: false
release:
types: [created]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
platform: linux/amd64
key: amd64
- runner: ubuntu-24.04-arm
platform: linux/arm64
key: arm64
runs-on: ${{ matrix.runner }}
permissions:
contents: read
packages: write
env:
VERSION: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref_name || github.ref_name }}
steps:
- uses: actions/checkout@v5
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: build
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
platforms: ${{ matrix.platform }}
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},name-canonical=true,push-by-digest=true,push=${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.release) || github.event_name == 'release' }}
labels: |
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Export image digest
if: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.release) || github.event_name == 'release' }}
run: printf '%s' "${{ steps.build.outputs.digest }}" > digest.txt
- uses: actions/upload-artifact@v6
if: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.release) || github.event_name == 'release' }}
with:
name: digest-${{ matrix.key }}
path: digest.txt
merge:
needs: build
runs-on: ubuntu-latest
if: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.release) || github.event_name == 'release' }}
permissions:
contents: read
packages: write
env:
VERSION: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref_name || github.ref_name }}
steps:
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@v3
- uses: actions/download-artifact@v6
with:
name: digest-amd64
path: digests/amd64
- uses: actions/download-artifact@v6
with:
name: digest-arm64
path: digests/arm64
- name: Publish multi-arch tags
run: |
IMAGE="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"
VERSION="${{ env.VERSION }}"
AMD64_DIGEST=$(cat digests/amd64/digest.txt)
ARM64_DIGEST=$(cat digests/arm64/digest.txt)
docker buildx imagetools create \
--tag "${IMAGE}:latest" \
"${IMAGE}@${AMD64_DIGEST}" \
"${IMAGE}@${ARM64_DIGEST}"
docker buildx imagetools create \
--tag "${IMAGE}:${VERSION}" \
"${IMAGE}@${AMD64_DIGEST}" \
"${IMAGE}@${ARM64_DIGEST}"