Files
openconcho/.github/workflows/docker-publish.yml
Offending Commit 526c45d9ce ci(docker): annotate image index so GHCR links the package to the repo
The publish step passed labels but not annotations, so
org.opencontainers.image.source landed only on per-platform configs, not
the multi-arch index. GHCR reads the source from the index annotation to
auto-link a package to its repo, so the package stayed orphaned.

- Set DOCKER_METADATA_ANNOTATIONS_LEVELS=index + pass annotations to the
  build, putting source/url/revision on the index.
- provenance: false keeps the pushed artifact a clean multi-arch index.
- workflow_dispatch now takes a 'tag' input to (re)publish a specific
  version; tags derived from the ref so dispatch and release both work.

Type ci → no version bump; republish v0.13.0 via dispatch.
2026-05-29 10:42:58 -05:00

72 lines
2.2 KiB
YAML

name: Publish web image
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: Existing tag to (re)build and publish, e.g. v0.13.0. Defaults to the triggering ref.
required: false
type: string
permissions:
contents: read
packages: write
jobs:
publish:
name: Build & push web image to GHCR
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag || github.ref }}
# Derive the image version from the tag (release ref or dispatch input) so
# raw tags work for both triggers — semver-from-ref doesn't fire on dispatch.
- id: ver
shell: bash
run: |
REF="${{ github.event.inputs.tag || github.ref_name }}"
V="${REF#v}"
echo "version=$V" >> "$GITHUB_OUTPUT"
echo "minor=${V%.*}" >> "$GITHUB_OUTPUT"
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v5
# Annotate the INDEX (not just per-platform configs) so GHCR can read
# org.opencontainers.image.source and auto-link the package to the repo.
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: index
with:
images: ghcr.io/${{ github.repository_owner }}/openconcho-web
tags: |
type=raw,value=${{ steps.ver.outputs.version }}
type=raw,value=${{ steps.ver.outputs.minor }}
type=raw,value=latest
type=sha,format=short
- uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
# provenance off keeps the pushed artifact a plain multi-arch index,
# so the index annotation below is what GHCR sees for repo linking.
provenance: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
cache-from: type=gha
cache-to: type=gha,mode=max