Skip to content

Commit 8837892

Browse files
authored
Create docker-image.yml
1 parent 36eb4bb commit 8837892

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/docker-image.yml

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

0 commit comments

Comments
 (0)