1+ name : Publish OCI Containers
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ release :
8+ types : [published]
9+ workflow_dispatch :
10+
11+ jobs :
12+
13+ backend-container :
14+ runs-on : ubuntu-latest
15+ permissions :
16+ contents : read
17+ packages : write
18+ attestations : write
19+ id-token : write
20+ env :
21+ REGISTRY : ghcr.io
22+ IMAGE_NAME : ${{ github.repository }}
23+
24+ steps :
25+ - name : Checkout repository
26+ uses : actions/checkout@v4
27+ - name : Log in to the Container registry
28+ uses : docker/login-action@v3
29+ with :
30+ registry : ${{ env.REGISTRY }}
31+ username : ${{ github.actor }}
32+ password : ${{ secrets.GITHUB_TOKEN }}
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+ - name : Build and push Docker image
39+ id : push
40+ uses : docker/build-push-action@v6
41+ with :
42+ context : .
43+ file : Containerfile
44+ push : true
45+ tags : ${{ steps.meta.outputs.tags }}
46+ labels : ${{ steps.meta.outputs.labels }}
47+
48+ - name : Generate artifact attestation
49+ uses : actions/attest-build-provenance@v2
50+ with :
51+ subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
52+ subject-digest : ${{ steps.push.outputs.digest }}
53+ push-to-registry : true
54+
55+ frontend-container :
56+ runs-on : ubuntu-latest
57+ permissions :
58+ contents : read
59+ packages : write
60+ attestations : write
61+ id-token : write
62+ env :
63+ REGISTRY : ghcr.io
64+ IMAGE_NAME : ${{ github.repository }}-web
65+
66+ steps :
67+ - name : Checkout repository
68+ uses : actions/checkout@v4
69+ - name : Log in to the Container registry
70+ uses : docker/login-action@v3
71+ with :
72+ registry : ${{ env.REGISTRY }}
73+ username : ${{ github.actor }}
74+ password : ${{ secrets.GITHUB_TOKEN }}
75+ - name : Extract metadata (tags, labels) for Docker
76+ id : meta
77+ uses : docker/metadata-action@v5
78+ with :
79+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
80+ - name : Build and push Docker image
81+ id : push
82+ uses : docker/build-push-action@v6
83+ with :
84+ context : web
85+ file : web/Containerfile
86+ push : true
87+ tags : ${{ steps.meta.outputs.tags }}
88+ labels : ${{ steps.meta.outputs.labels }}
89+
90+ - name : Generate artifact attestation
91+ uses : actions/attest-build-provenance@v2
92+ with :
93+ subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
94+ subject-digest : ${{ steps.push.outputs.digest }}
95+ push-to-registry : true
0 commit comments