File tree Expand file tree Collapse file tree 1 file changed +37
-2
lines changed Expand file tree Collapse file tree 1 file changed +37
-2
lines changed Original file line number Diff line number Diff line change 7
7
pull_request :
8
8
branches :
9
9
- master
10
+ env :
11
+ REGISTRY : ghcr.io
12
+ IMAGE_NAME : ${{ github.repository }}
10
13
11
14
jobs :
12
15
build :
13
16
runs-on : ubuntu-latest
14
17
18
+ permissions :
19
+ contents : read
20
+ packages : write
21
+ attestations : write
22
+ id-token : write
23
+
15
24
steps :
16
25
- name : Checkout code
17
26
uses : actions/checkout@v2
39
48
- name : Package
40
49
run : mvn package
41
50
42
- - name : Docker
43
- run : docker build -t intellicode/kotlin-hello .
51
+ - name : Log in to the Container registry
52
+ uses : docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
53
+ with :
54
+ registry : ${{ env.REGISTRY }}
55
+ username : ${{ github.actor }}
56
+ password : ${{ secrets.GITHUB_TOKEN }}
57
+
58
+ - name : Extract metadata (tags, labels) for Docker
59
+ id : meta
60
+ uses : docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
61
+ with :
62
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
63
+
64
+ - name : Build and push Docker image
65
+ id : push
66
+ uses : docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
67
+ with :
68
+ context : .
69
+ push : true
70
+ tags : ${{ steps.meta.outputs.tags }}
71
+ labels : ${{ steps.meta.outputs.labels }}
72
+
73
+ - name : Generate artifact attestation
74
+ uses : actions/attest-build-provenance@v2
75
+ with :
76
+ subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
77
+ subject-digest : ${{ steps.push.outputs.digest }}
78
+ push-to-registry : true
You can’t perform that action at this time.
0 commit comments