44 push :
55 branches : [ main ]
66 # tags: [ 'v*' ]
7- pull_request :
8- branches : [ main ]
97
108env :
119 REGISTRY : ghcr.io
2422
2523 - name : Set up Docker Buildx
2624 uses : docker/setup-buildx-action@v3
27- with :
28- version : latest
2925
3026 - name : Log in to GitHub Container Registry
3127 uses : docker/login-action@v3
4137 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4238 tags : |
4339 type=ref,event=branch
44- type=ref,event=pr
40+ type=ref,event=tag
4541 type=semver,pattern={{version}}
4642 type=semver,pattern={{major}}.{{minor}}
4743 type=semver,pattern={{major}}
@@ -52,31 +48,16 @@ jobs:
5248 with :
5349 context : .
5450 file : ./Dockerfile
55- platforms : linux/amd64,linux/arm64
56- push : ${{ github.event_name != 'pull_request' }}
51+ push : true
5752 tags : ${{ steps.meta.outputs.tags }}
5853 labels : ${{ steps.meta.outputs.labels }}
5954 cache-from : type=gha
6055 cache-to : type=gha,mode=max
6156
62- - name : Run Trivy vulnerability scanner
63- uses : aquasecurity/trivy-action@master
64- with :
65- image-ref : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
66- format : ' sarif'
67- output : ' trivy-results.sarif'
68-
69- - name : Upload Trivy scan results
70- uses : github/codeql-action/upload-sarif@v2
71- with :
72- sarif_file : ' trivy-results.sarif'
73- if : always()
74-
75- # Separate job for testing the Docker image
7657 test-docker :
7758 runs-on : ubuntu-latest
7859 needs : build-and-push
79- if : github.event_name != 'pull_request '
60+ if : github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master '
8061
8162 steps :
8263 - name : Test Docker image
0 commit comments