From 5bf3b69ece6dd6cb4d65e27ef161a885c8410b43 Mon Sep 17 00:00:00 2001 From: Ruffin Date: Thu, 23 Mar 2023 15:49:27 +0100 Subject: [PATCH] Add labels to pushed image versions (#3505) using Pre-Defined Annotation Keys as defined by The OpenContainers Annotations Spec - https://specs.opencontainers.org/image-spec/annotations/#pre-defined-annotation-keys - https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows - https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#get-a-repository --- .github/workflows/update_ci_image.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/update_ci_image.yaml b/.github/workflows/update_ci_image.yaml index a3250914d74..9067e923742 100644 --- a/.github/workflows/update_ci_image.yaml +++ b/.github/workflows/update_ci_image.yaml @@ -75,6 +75,9 @@ jobs: - name: Set build config id: config run: | + created=$(date -u +'%Y-%m-%dT%H:%M:%SZ') + echo "created=${created}" >> $GITHUB_OUTPUT + version=$(grep -oP '(?<=).*?(?=)' navigation2/package.xml) echo "version=${version}" >> $GITHUB_OUTPUT @@ -109,6 +112,19 @@ jobs: tags: | ghcr.io/${{ github.repository }}:${{ github.ref_name }} ghcr.io/${{ github.repository }}:${{ github.ref_name }}-${{ steps.config.outputs.version }} + labels: | + org.opencontainers.image.authors=${{ github.event.repository.owner.html_url }} + org.opencontainers.image.created=${{ steps.config.outputs.created }} + org.opencontainers.image.description=${{ github.event.repository.description }} + org.opencontainers.image.documentation=${{ github.event.repository.homepage }} + org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }} + org.opencontainers.image.ref.name=${{ github.ref }} + org.opencontainers.image.revision=${{ github.sha }} + org.opencontainers.image.source=${{ github.event.repository.clone_url }} + org.opencontainers.image.title=${{ github.event.repository.name }} + org.opencontainers.image.url=${{ github.event.repository.html_url }} + org.opencontainers.image.vendor=${{ github.event.repository.owner.login }} + org.opencontainers.image.version=${{ steps.config.outputs.version }} - name: Image digest if: steps.config.outputs.trigger == 'true' run: echo ${{ steps.docker_build.outputs.digest }}