Files
Libation/.github/workflows/docker.yml
Kris Anderson cc75b348ee Docker: don't move latest to pre-release images
docker.yml sets `latest=true`, so every tagged release, release
candidates included, also updates `rmcrackan/libation:latest`. The
v14.3.0-rc.1 build on 2026-11-13 gave `latest` and `14.3.0-rc.1` the same
digest, so everyone following `latest` (the tag the Docker docs use)
got the RC without choosing it.

Set `latest` only when the version has no pre-release suffix (no `-`).
RC builds still push their own version tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 19:57:41 -08:00

70 lines
2.1 KiB
YAML

# docker.yml
# Reusable workflow that builds a docker image for Libation.
---
name: docker
on:
workflow_call:
inputs:
version:
type: string
description: "Version number"
required: true
release:
type: boolean
description: "Is this a release build?"
required: true
secrets:
docker_username:
required: true
docker_token:
required: true
jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to Docker Hub
if: ${{ inputs.release }}
uses: docker/login-action@v4.8.0
with:
username: ${{ secrets.docker_username }}
password: ${{ secrets.docker_token }}
- name: Generate docker image tags
id: metadata
uses: docker/metadata-action@v6
with:
# Pre-release versions (e.g. 14.3.0-rc.1) get only their version tag,
# so `latest` keeps pointing at the newest stable release.
flavor: |
latest=${{ !contains(inputs.version, '-') }}
images: |
name=${{ secrets.docker_username }}/libation
tags: |
type=raw,value=${{ inputs.version }},enable=${{ inputs.release }}
- name: Build and push image
uses: docker/build-push-action@v7
with:
# Avoid default git context refs/pull/*/merge (breaks after PR merge or on some re-runs).
context: .
platforms: linux/amd64,linux/arm64
push: ${{ steps.metadata.outputs.tags != ''}}
# Always read cache. Only write on release so PR validate cannot fail
# when GHA cache is full or the token cannot write cache.
cache-from: type=gha
cache-to: ${{ inputs.release && 'type=gha,mode=max,ignore-error=true' || '' }}
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}