Skip to content

Merge pull request #2454 from aboutcode-org/prepare-v40.1.0 #1

Merge pull request #2454 from aboutcode-org/prepare-v40.1.0

Merge pull request #2454 from aboutcode-org/prepare-v40.1.0 #1

name: Create and publish Docker image on GHCR
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Log in to the Container registry
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
labels: |
org.opencontainers.image.title=VulnerableCode
org.opencontainers.image.description=A free and open vulnerability database with tools to track, aggregate, and correlate package vulnerabilities
org.opencontainers.image.licenses=Apache-2.0
annotations: |
org.opencontainers.image.title=VulnerableCode
org.opencontainers.image.description=A free and open vulnerability database with tools to track, aggregate, and correlate package vulnerabilities
org.opencontainers.image.licenses=Apache-2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
- name: Build and push Docker image
id: push
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
provenance: false
- name: Generate artifact attestation
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true