@@ -2,15 +2,54 @@ name: Docker Image CI
22
33on :
44 push :
5+ branches : [ "release" ]
56 tags : [ "*.*.*" ]
67
7- jobs :
8-
9- build :
8+ env :
9+ REGISTRY : ghcr.io
10+ IMAGE_NAME : vsftpd
1011
12+ jobs :
13+ build-and-push-image :
1114 runs-on : ubuntu-latest
15+ permissions :
16+ contents : read
17+ packages : write
18+ attestations : write
19+ id-token : write
1220
1321 steps :
14- - uses : actions/checkout@v4
15- - name : Build the Docker image
16- run : docker build . --file Dockerfile --tag vsftpd:$(date +%s)
22+ - name : Checkout repository
23+ uses : actions/checkout@v4
24+
25+ - name : Log in to the Container registry
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@v3
49+ with :
50+ subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
51+ subject-digest : ${{ steps.push.outputs.digest }}
52+ push-to-registry : true
53+
54+ # - name: Build the Docker image
55+ # run: docker build . --file Dockerfile --tag vsftpd:$(date +%s)
0 commit comments