Skip to content

chore: add annotations to manifest #545

chore: add annotations to manifest

chore: add annotations to manifest #545

Workflow file for this run

---
name: Build & Push
on:
merge_group:
pull_request:
push:
tags: ["v*.*.*"]
workflow_dispatch:
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
permissions:
contents: read
env:
REGISTRY: ghcr.io
jobs:
build-push:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
pull-requests: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- uses: sigstore/cosign-installer@1fc5bd396d372bee37d608f955b336615edf79c8 # v3.2.0
if: ${{ github.event_name != 'merge_group' }}
- uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
id: meta
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
# Generate Docker tags based on the following events/attributes
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- run: |
set -Eeuo pipefail
ANNOTATIONS=$(echo '${{ steps.meta.outputs.labels }}' | sed 's/org.opencontainers.image./annotation-index.org.opencontainers.image./' | tr '\n' ',')
echo annotations=${ANNOTATIONS::-1} >> "$GITHUB_OUTPUT"
id: annotations
- uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
if: ${{ github.event_name != 'merge_group' }}
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
id: build-and-push
with:
file: .devcontainer/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'merge_group' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs: ${{ steps.annotations.outputs.annotations }}type=image,name=target
sbom: true
provenance: true
cache-from: type=gha
cache-to: type=gha,mode=max
- uses: anchore/sbom-action@78fc58e266e87a38d4194b2137a3d4e9bcaf7ca1 # v0.14.3
if: ${{ steps.build-and-push.outputs.digest != '' }}
with:
image: ${{ env.REGISTRY }}/${{ github.repository }}@${{ steps.build-and-push.outputs.digest }}
dependency-snapshot: true
- uses: actions/dependency-review-action@fde92acd0840415674c16b39c7d703fc28bc511e # v3.1.2
if: ${{ github.event_name == 'pull_request' }}
with:
comment-summary-in-pr: on-failure
fail-on-severity: critical
- name: Sign the image with GitHub OIDC token
if: ${{ github.event_name != 'merge_group' }}
# This step uses the GitHub OIDC identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
env:
DIGEST: ${{ steps.build-and-push.outputs.digest }}
TAGS: ${{ steps.meta.outputs.tags }}
run: echo "${TAGS}" | xargs -I {} cosign sign --yes "{}@${DIGEST}"