Merge pull request #44 from offendingcommit/ci/ghcr-repo-link

ci(docker): link GHCR package to repo via index annotation
This commit is contained in:
Offending Commit
2026-05-29 10:43:35 -05:00
committed by GitHub

View File

@@ -4,6 +4,11 @@ on:
release: release:
types: [published] types: [published]
workflow_dispatch: 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: permissions:
contents: read contents: read
@@ -15,6 +20,18 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - 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-qemu-action@v3
- uses: docker/setup-buildx-action@v3 - uses: docker/setup-buildx-action@v3
@@ -27,11 +44,15 @@ jobs:
- id: meta - id: meta
uses: docker/metadata-action@v5 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: with:
images: ghcr.io/${{ github.repository_owner }}/openconcho-web images: ghcr.io/${{ github.repository_owner }}/openconcho-web
tags: | tags: |
type=semver,pattern={{version}} type=raw,value=${{ steps.ver.outputs.version }}
type=semver,pattern={{major}}.{{minor}} type=raw,value=${{ steps.ver.outputs.minor }}
type=raw,value=latest type=raw,value=latest
type=sha,format=short type=sha,format=short
@@ -40,7 +61,11 @@ jobs:
context: . context: .
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: true 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 }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max