File tree Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Original file line number Diff line number Diff line change 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 version from tag
34+ run : echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
35+
36+ - name : Extract metadata (tags, labels) for Docker
37+ id : meta
38+ uses : docker/metadata-action@v5
39+ with :
40+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+
42+ - name : Build and push Docker image
43+ id : push
44+ uses : docker/build-push-action@v6
45+ with :
46+ context : .
47+ push : true
48+ tags : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
49+ labels : ${{ steps.meta.outputs.labels }}
50+
51+ - name : Generate artifact attestation
52+ uses : actions/attest-build-provenance@v1
53+ with :
54+ subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
55+ subject-digest : ${{ steps.push.outputs.digest }}
56+ push-to-registry : true
You can’t perform that action at this time.
0 commit comments