Skip to content

Commit 1afec52

Browse files
authored
chore: add annotations to manifest (#201)
* chore: add test annotation to manifest * chore: correct annotation syntax * chore: derive manifest labels from metadata action * chore: correct syntax for GITHUB_OUTPUT * chore: fixing shell issue * chore: more shell fixing * chore: more shell fun * chore: more shell fun * chore: more shell fun * chore: satisfy linter * chore: try to use derived image name * chore: don't scan images that are not pushed to the registry
1 parent 96157b1 commit 1afec52

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.github/workflows/build-push.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ jobs:
4242
type=semver,pattern={{version}}
4343
type=semver,pattern={{major}}.{{minor}}
4444
type=semver,pattern={{major}}
45+
- run: |
46+
set -Eeuo pipefail
47+
ANNOTATIONS=$(echo '${{ steps.meta.outputs.labels }}' | sed 's/org.opencontainers.image./annotation-index.org.opencontainers.image./' | tr '\n' ',')
48+
echo "annotations=${ANNOTATIONS::-1}" >> "$GITHUB_OUTPUT"
49+
id: annotations
4550
- uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
4651
- uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
4752
- uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
@@ -58,12 +63,13 @@ jobs:
5863
push: ${{ github.event_name != 'merge_group' }}
5964
tags: ${{ steps.meta.outputs.tags }}
6065
labels: ${{ steps.meta.outputs.labels }}
66+
outputs: type=image,${{ steps.annotations.outputs.annotations }}
6167
sbom: true
6268
provenance: true
6369
cache-from: type=gha
6470
cache-to: type=gha,mode=max
6571
- uses: anchore/sbom-action@78fc58e266e87a38d4194b2137a3d4e9bcaf7ca1 # v0.14.3
66-
if: ${{ steps.build-and-push.outputs.digest != '' }}
72+
if: ${{ steps.build-and-push.outputs.digest != '' && github.event_name != 'merge_group' }}
6773
with:
6874
image: ${{ env.REGISTRY }}/${{ github.repository }}@${{ steps.build-and-push.outputs.digest }}
6975
dependency-snapshot: true

0 commit comments

Comments
 (0)