Skip to content

Commit 6c89f4a

Browse files
committed
Publish container
1 parent 5f13308 commit 6c89f4a

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/build-publish.yaml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Create and publish a Docker image
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
build-and-push-image:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
attestations: write
19+
id-token: write
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
- name: Log in to the Container registry
24+
uses: docker/login-action@v3
25+
with:
26+
registry: ${{ env.REGISTRY }}
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
29+
- name: Extract metadata (tags, labels) for Docker
30+
id: meta
31+
uses: docker/metadata-action@v5
32+
with:
33+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
34+
- name: Build and push Docker image
35+
id: push
36+
uses: docker/build-push-action@v6
37+
with:
38+
context: .
39+
push: true
40+
tags: ${{ steps.meta.outputs.tags }}
41+
labels: ${{ steps.meta.outputs.labels }}
42+
43+
- name: Generate artifact attestation
44+
uses: actions/attest-build-provenance@v2
45+
with:
46+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
47+
subject-digest: ${{ steps.push.outputs.digest }}
48+
push-to-registry: true
49+
50+

0 commit comments

Comments
 (0)