Skip to content

Latest release

Latest release #19

Workflow file for this run

# This workflow builds the Dockerfile and publishes the image to GitHub Container Registry (GHCR)
# whenever a GitHub Release is published.
name: Publish Image
on:
workflow_dispatch:
push:
branches: [ main ]
release:
types: [ published ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GHCR
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GH_TOKEN }}
- name: Parse release version
id: version
run: |
# GITHUB TAG NAME = v20260727.10000
# BUILD = 20260727.10000
# MINOR = 20260727
# MAJOR = 1 (always 1 for this project)
TAG_NAME="${{ github.event.release.tag_name }}"
if [ -z "$TAG_NAME" ]; then
echo "No release tag_name available (likely a workflow_dispatch run); skipping version tags." >&2
exit 0
fi
BUILD="${TAG_NAME#v}"
MINOR="${BUILD%%.*}"
echo "build=$BUILD" >> "$GITHUB_OUTPUT"
echo "minor=$MINOR" >> "$GITHUB_OUTPUT"
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=raw,value=${{ steps.version.outputs.build }},enable=${{ steps.version.outputs.build != '' }}
type=raw,value=${{ steps.version.outputs.minor }},enable=${{ steps.version.outputs.minor != '' }}
type=raw,value=1,enable=${{ steps.version.outputs.build != '' }}
type=raw,value=latest
- name: Build and push image
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
provenance: false