Skip to content

Commit c4b848b

Browse files
authored
GH workflow: docker publish for version tags
1 parent 823e6db commit c4b848b

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

.github/workflows/docker_publish.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@ name: Create and publish a Docker image
44
on:
55
push:
66
branches: ['main']
7-
7+
tags:
8+
- v*
9+
workflow_dispatch:
10+
inputs:
11+
tag:
12+
description: "Git tag to build (e.g., v1.2.3)"
13+
required: true
14+
type: string
15+
816
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
917
env:
1018
REGISTRY: ghcr.io
@@ -37,19 +45,22 @@ jobs:
3745
uses: docker/setup-buildx-action@v3
3846

3947
- name: Build and push Docker image
40-
uses: docker/build-push-action@v5
48+
id: buildpush
49+
uses: docker/build-push-action@v6
4150
with:
4251
context: .
4352
file: docker/Dockerfile
4453
push: true
4554
tags: ${{ steps.meta.outputs.tags }}
4655
labels: ${{ steps.meta.outputs.labels }}
4756
platforms: linux/amd64,linux/arm64
57+
provenance: false # Disable provenance to avoid unknown/unknown
58+
sbom: false # Disable sbom to avoid unknown/unknown
4859

4960
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see [Using artifact attestations to establish provenance for builds](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds).
5061
- name: Generate artifact attestation
5162
uses: actions/attest-build-provenance@v3
5263
with:
5364
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
54-
subject-digest: ${{ steps.push.outputs.digest }}
55-
push-to-registry: true
65+
subject-digest: ${{ steps.buildpush.outputs.digest }}
66+
push-to-registry: true

0 commit comments

Comments
 (0)