File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed
Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Publish Docker Image
2+ on :
3+ push :
4+ branches :
5+ - master
6+ tags :
7+ - " v*"
8+
9+ # based on https://docs.github.com/en/actions/tutorials/publish-packages/publish-docker-images
10+
11+ env :
12+ REGISTRY : ghcr.io
13+ IMAGE_NAME : ${{ github.repository }}
14+
15+ jobs :
16+ build-and-push-image :
17+ name : Build Docker container and push it to GitHub registry
18+ runs-on : ubuntu-latest
19+ permissions :
20+ packages : write
21+ contents : read
22+ attestations : write
23+ id-token : write
24+ steps :
25+ - name : Check out the repo
26+ uses : actions/checkout@v5
27+
28+ - name : Login to ghcr.io
29+ uses : docker/login-action@v3
30+ with :
31+ registry : ${{ env.REGISTRY }}
32+ username : ${{ github.actor }}
33+ password : ${{ secrets.GITHUB_TOKEN }}
34+
35+ - name : Extract metadata (tags, labels) for Docker
36+ id : meta
37+ uses : docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
38+ with :
39+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40+
41+ - name : Build and push Docker image
42+ id : push
43+ uses : docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
44+ with :
45+ context : .
46+ push : true
47+ tags : ${{ steps.meta.outputs.tags }}
48+ labels : ${{ steps.meta.outputs.labels }}
49+
50+ - name : Generate artifact attestation
51+ uses : actions/attest-build-provenance@v3
52+ with :
53+ subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
54+ subject-digest : ${{ steps.push.outputs.digest }}
55+ push-to-registry : true
You can’t perform that action at this time.
0 commit comments