Skip to content

Publish docker image #3

Publish docker image

Publish docker image #3

Workflow file for this run

name: Publish docker image
on:
workflow_dispatch:
inputs:
release_tag:
description: 'Tag to release'
required: true
type: string
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
if: startsWith(github.event.inputs.release_tag, 'v')
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Validate tag format
run: |
TAG=${{ github.event.inputs.release_tag }}
if ! echo "$TAG" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "❌ Invalid tag format: $TAG"
exit 1
fi
echo "✅ Valid semver tag: $TAG"
- name: Log in to GitHub Container Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU for ARM builds
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Build and push Docker image
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository }}:${{ github.event.inputs.release_tag }}