name: Docker
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: 'Version to build (without leading "v")'
required: true
permissions:
contents: read
packages: write
jobs:
docker:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v6
- name: Resolve version
id: version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
VERSION="${{ github.event.inputs.version }}"
else
VERSION="${GITHUB_REF_NAME#v}"
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Wait for release assets
run: |
base="https://github.com/zifeo/lade/releases/download/v${{ steps.version.outputs.version }}"
asset="lade-v${{ steps.version.outputs.version }}-x86_64-unknown-linux-musl.tar.gz"
for _ in $(seq 1 30); do
if curl -fsSLI "$base/$asset" >/dev/null 2>&1; then
echo "Release asset available."
exit 0
fi
echo "Waiting for release asset $asset ..."
sleep 20
done
echo "Release asset not found in time." >&2
exit 1
- uses: docker/setup-qemu-action@v4
- uses: docker/setup-buildx-action@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/zifeo/lade
tags: |
type=semver,pattern={{version}},value=${{ steps.version.outputs.version }}
type=semver,pattern={{major}}.{{minor}},value=${{ steps.version.outputs.version }}
type=raw,value=latest
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: |
VERSION=${{ steps.version.outputs.version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}