The semver pattern in docker/metadata-action requires 3-part versions (e.g. v0.29.0). Our tags use 2-part (v0.29), causing the metadata step to produce empty tags, which made build-push-action fail. Fix: use type=match with regex to extract the version string directly, plus type=raw for the latest tag unconditionally. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
57 lines
1.6 KiB
YAML
57 lines
1.6 KiB
YAML
name: Release & Docker
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write # required: create GitHub Release
|
|
packages: write # required: push to ghcr.io
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# Create GitHub Release from tag with auto-generated notes
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
generate_release_notes: true
|
|
|
|
# Set up multi-arch build (QEMU + Buildx)
|
|
- uses: docker/setup-qemu-action@v3
|
|
- uses: docker/setup-buildx-action@v3
|
|
|
|
# Log in to GitHub Container Registry
|
|
- name: Log in to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# Extract semver tags: e.g. v0.28 -> 0.28, latest
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ghcr.io/${{ github.repository }}
|
|
tags: |
|
|
type=match,pattern=v(.*),group=1
|
|
type=raw,value=latest
|
|
|
|
# Build and push multi-arch image (amd64 + arm64)
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|