ci: annotate image indexes and attach SBOMs

- The multi-platform index now carries the OCI annotations (version,
  title, description, licenses, plus metadata-action's revision, source
  and created). Labels only live in each platform's image config, so
  GHCR showed no description for the package.
- Labels drop the literal quotes metadata-action kept in their values,
  and the licence is the SPDX id AGPL-3.0-only. The description has one
  home in the workflow env.
- Both builds attach an SBOM attestation alongside the default
  provenance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01817LYuBpFBV5Pi6VEcKfFZ
This commit is contained in:
Sam Dornan
2026-09-23 10:47:37 +00:00
committed by Claude
parent 7ddf718e94
commit daf818c5f4

View File

@@ -24,6 +24,7 @@ permissions:
# `build` pushes digests here and `merge` tags them from here; the two must agree.
env:
DIGEST_IMAGE: ghcr.io/${{ github.repository_owner }}/romm
IMAGE_DESCRIPTION: RomM (ROM Manager) allows you to scan, enrich, and browse your game collection with a clean and responsive interface. With support for multiple platforms, various naming schemes and custom tags, RomM is a must-have for anyone who plays on emulators.
jobs:
validate-tag-semver:
@@ -107,9 +108,9 @@ jobs:
type=raw,value=edge,enable=${{ github.event_name == 'push' }}
labels: |
org.opencontainers.image.version={{version}}-slim
org.opencontainers.image.title="rommapp/romm"
org.opencontainers.image.description="RomM (ROM Manager) allows you to scan, enrich, and browse your game collection with a clean and responsive interface. With support for multiple platforms, various naming schemes and custom tags, RomM is a must-have for anyone who plays on emulators."
org.opencontainers.image.licenses="AGPLv3"
org.opencontainers.image.title=rommapp/romm
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }}
org.opencontainers.image.licenses=AGPL-3.0-only
- name: Generate Docker metadata (full)
id: meta
@@ -125,9 +126,9 @@ jobs:
type=raw,value=edge,enable=${{ github.event_name == 'push' }}
labels: |
org.opencontainers.image.version={{version}}
org.opencontainers.image.title="rommapp/romm"
org.opencontainers.image.description="RomM (ROM Manager) allows you to scan, enrich, and browse your game collection with a clean and responsive interface. With support for multiple platforms, various naming schemes and custom tags, RomM is a must-have for anyone who plays on emulators."
org.opencontainers.image.licenses="AGPLv3"
org.opencontainers.image.title=rommapp/romm
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }}
org.opencontainers.image.licenses=AGPL-3.0-only
# Edge builds carry the short commit so each one is identifiable and busts
# version-keyed caches.
@@ -149,6 +150,7 @@ jobs:
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta-slim.outputs.labels }}
target: slim-image
sbom: true
outputs: type=image,name=${{ env.DIGEST_IMAGE }},push-by-digest=true,name-canonical=true,push=true
# Both stages run `apk upgrade` off a fixed base digest, so nothing in
# them changes between releases and the cache would serve the package
@@ -174,6 +176,7 @@ jobs:
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
target: full-image
sbom: true
outputs: type=image,name=${{ env.DIGEST_IMAGE }},push-by-digest=true,name-canonical=true,push=true
no-cache-filters: python-runtime,production-stage
cache-from: |
@@ -249,6 +252,8 @@ jobs:
- name: Generate Docker metadata (slim)
id: meta-slim
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: index
with:
images: |
name=rommapp/romm
@@ -261,10 +266,17 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=edge,enable=${{ github.event_name == 'push' }}
annotations: |
org.opencontainers.image.version={{version}}-slim
org.opencontainers.image.title=rommapp/romm
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }}
org.opencontainers.image.licenses=AGPL-3.0-only
- name: Generate Docker metadata (full)
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: index
with:
images: |
name=rommapp/romm
@@ -274,6 +286,11 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=edge,enable=${{ github.event_name == 'push' }}
annotations: |
org.opencontainers.image.version={{version}}
org.opencontainers.image.title=rommapp/romm
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }}
org.opencontainers.image.licenses=AGPL-3.0-only
# Tags spanning both registries are fine here: `imagetools create` copies
# the blobs over when a target sits in a different registry than the digests.
@@ -290,6 +307,13 @@ jobs:
tags+=(--tag "$tag")
done < <(jq -r '.tags[]' <<<"$metadata")
# The labels only reach each platform's image config; registries
# read a multi-platform image's metadata from its index.
local annotations=()
while IFS= read -r annotation; do
annotations+=(--annotation "$annotation")
done < <(jq -r '.annotations[]' <<<"$metadata")
local sources=()
local digest
for digest in "$dir"/*; do
@@ -304,7 +328,7 @@ jobs:
return 1
fi
docker buildx imagetools create "${tags[@]}" "${sources[@]}"
docker buildx imagetools create "${tags[@]}" "${annotations[@]}" "${sources[@]}"
}
push_variant /tmp/digests/slim "$SLIM_METADATA"