11name : CICD
22
33on :
4+ push :
5+ branches : ["**"]
6+ tags : ["*.*.*"]
47 release :
5- types : [published, prereleased ]
8+ types : [created ]
69
710env :
811 REGISTRY : ghcr.io
2528 - name : Checkout repository
2629 uses : actions/checkout@v4
2730
31+ # replaces slashes with dashes in platform name
2832 - name : Convert platform pairs
2933 run : |
3034 platform=${{ matrix.platform }}
3438 uses : docker/setup-buildx-action@v3
3539
3640 - name : Log into registry ${{ env.REGISTRY }}
41+ if : github.event_name != 'pull_request'
3742 uses : docker/login-action@v3
3843 with :
3944 registry : ${{ env.REGISTRY }}
5358 context : .
5459 platforms : ${{ matrix.platform }}
5560 labels : ${{ steps.meta.outputs.labels }}
56- outputs : type=image,name=${{ env.REGISTRY }}/${{ github.repository }},push-by-digest=true,name-canonical=true,push=true
61+ outputs : type=image,name=${{ env.REGISTRY }}/${{ github.repository }},push-by-digest=true,name-canonical=true,push=${{ github.event_name != 'pull_request' }}
5762
5863 - name : Export digest
5964 run : |
7176
7277 merge :
7378 runs-on : ubuntu-latest
79+ if : ${{ github.event_name != 'pull_request' }}
7480 needs :
7581 - build
7682 steps :
@@ -90,10 +96,14 @@ jobs:
9096 with :
9197 images : ${{ env.REGISTRY }}/${{ github.repository }}
9298 tags : |
99+ type=ref,event=branch
93100 type=ref,event=tag
101+ type=ref,event=pr
102+ type=sha
94103 type=semver,pattern={{version}}
95104
96105 - name : Log into registry ${{ env.REGISTRY }}
106+ if : github.event_name != 'pull_request'
97107 uses : docker/login-action@v3
98108 with :
99109 registry : ${{ env.REGISTRY }}
@@ -108,4 +118,4 @@ jobs:
108118
109119 - name : Inspect image
110120 run : |
111- docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ github.repository }}:${{ steps.meta.outputs.version }}
121+ docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ github.repository }}:${{ steps.meta.outputs.version }}
0 commit comments