Skip to content

Commit f5e10f9

Browse files
author
Leo Park
committed
1 parent b4c37cb commit f5e10f9

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Create and publish a Docker image
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
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+
16+
permissions:
17+
contents: read
18+
packages: write
19+
attestations: write
20+
id-token: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Log in to the Container registry
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ${{ env.REGISTRY }}
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Extract metadata (tags, labels) for Docker
34+
id: meta
35+
uses: docker/metadata-action@v5
36+
with:
37+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38+
tags: type=semver, pattern={{raw}}
39+
40+
- name: Build and push Docker image
41+
id: push
42+
uses: docker/build-push-action@v6
43+
with:
44+
context: .
45+
push: true
46+
tags: ${{ steps.meta.outputs.tags }}
47+
labels: ${{ steps.meta.outputs.labels }}
48+
49+
- name: Generate artifact attestation
50+
uses: actions/attest-build-provenance@v1
51+
with:
52+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
53+
subject-digest: ${{ steps.push.outputs.digest }}
54+
push-to-registry: true

0 commit comments

Comments
 (0)