From b8ac3504b83077e688cbe39d1ea3a5f5f4aeaf96 Mon Sep 17 00:00:00 2001 From: Hadrien Patte Date: Sat, 24 Aug 2024 23:41:48 +0200 Subject: [PATCH] Add image description annotation --- .github/scripts/build-image.sh | 6 ++++-- .github/workflows/build-images.yaml | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/scripts/build-image.sh b/.github/scripts/build-image.sh index 3d97596..2e92035 100755 --- a/.github/scripts/build-image.sh +++ b/.github/scripts/build-image.sh @@ -9,6 +9,7 @@ DEFAULT_GOLANG_VERSION="1.21" DEFAULT_CHISEL_VERSION="v0.10.0" REPOSITORY=$(jq -r '.repository' ./images/${IMAGE}/metadata.json) +DESCRIPTION=$(curl -s "https://api.github.com/repos/${REPOSITORY}" | jq -r '.description | values') RELEASE_METADATA=$(curl -s "https://api.github.com/repos/${REPOSITORY}/releases/latest") SOURCE_DATE_EPOCH=$(date +%s -d $(echo ${RELEASE_METADATA} | jq -r '.created_at')) RELEASE=$(echo ${RELEASE_METADATA} | jq -r '.tag_name') @@ -35,7 +36,8 @@ else --label "org.opencontainers.image.version=${VERSION}" \ --label "org.opencontainers.image.vendor=${GITHUB_REPOSITORY_OWNER}" \ --label "org.opencontainers.image.title=${IMAGE}" \ - --output type=registry,name=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/${IMAGE}:${VERSION},rewrite-timestamp=true \ - --output type=registry,name=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/${IMAGE}:latest,rewrite-timestamp=true \ + --annotation "org.opencontainers.image.description=${DESCRIPTION}" \ + --output "type=registry,name=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/${IMAGE}:${VERSION},rewrite-timestamp=true" \ + --output "type=registry,name=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/${IMAGE}:latest,rewrite-timestamp=true" \ - < images/${IMAGE}/Dockerfile fi diff --git a/.github/workflows/build-images.yaml b/.github/workflows/build-images.yaml index 883a3ff..dc6aeb1 100644 --- a/.github/workflows/build-images.yaml +++ b/.github/workflows/build-images.yaml @@ -3,6 +3,7 @@ on: push: branches: - main + - desc # TODO2 name: Build images