5
5
tags :
6
6
- ' v*.*.*'
7
7
8
+ env :
9
+ REGISTRY : ghcr.io
10
+ IMAGE_NAME : ${{ github.repository }}
11
+
8
12
jobs :
9
13
deployment :
10
14
name : Deployment
11
15
runs-on : ubuntu-latest
16
+ permissions :
17
+ contents : read
18
+ packages : write
19
+ attestations : write
20
+ id-token : write
12
21
environment : production
13
22
steps :
14
- - name : Docker meta
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 metadata (tags, labels) for Docker
15
34
id : meta
16
35
uses : docker/metadata-action@v5
17
36
with :
18
- # list of Docker images to use as base name for tags
19
- images : |
20
- appsinet/php_development
21
- # generate Docker tags based on the following events/attributes
22
- tags : |
23
- type=schedule,pattern={{date 'YYYYMMDD'}}
24
- type=ref,event=tag
25
- type=semver,pattern={{version}}
26
- type=semver,pattern={{major}}.{{minor}}
27
- type=semver,pattern={{major}}
28
- type=sha
37
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
29
38
30
- - name : Set up Docker Buildx
31
- uses : docker/setup-buildx-action@v3
32
-
33
- - name : Login to DockerHub
34
- uses : docker/login-action@v3
39
+ - name : Build and push Docker image
40
+ id : push
41
+ uses : docker/build-push-action@v5
35
42
with :
36
- username : ${{ secrets.DOCKERHUB_USERNAME }}
37
- password : ${{ secrets.DOCKERHUB_TOKEN }}
43
+ context : .
44
+ push : true
45
+ tags : ${{ steps.meta.outputs.tags }}
46
+ labels : ${{ steps.meta.outputs.labels }}
38
47
39
- - name : Build and push
40
- uses : docker/ build-push-action@v5
48
+ - name : Generate artifact attestation
49
+ uses : actions/attest- build-provenance@v2
41
50
with :
42
- push : ${{ github.event_name != 'pull_request' }}
43
- tags : ${{ steps.meta.outputs.tags }}
51
+ subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
52
+ subject-digest : ${{ steps.push.outputs.digest }}
53
+ push-to-registry : true
0 commit comments