1
1
name : CICD
2
2
3
3
on :
4
+ push :
5
+ branches : ["**"]
6
+ tags : ["*.*.*"]
4
7
release :
5
- types : [published, prereleased ]
8
+ types : [created ]
6
9
7
10
env :
8
11
REGISTRY : ghcr.io
25
28
- name : Checkout repository
26
29
uses : actions/checkout@v4
27
30
31
+ # replaces slashes with dashes in platform name
28
32
- name : Convert platform pairs
29
33
run : |
30
34
platform=${{ matrix.platform }}
34
38
uses : docker/setup-buildx-action@v3
35
39
36
40
- name : Log into registry ${{ env.REGISTRY }}
41
+ if : github.event_name != 'pull_request'
37
42
uses : docker/login-action@v3
38
43
with :
39
44
registry : ${{ env.REGISTRY }}
53
58
context : .
54
59
platforms : ${{ matrix.platform }}
55
60
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' }}
57
62
58
63
- name : Export digest
59
64
run : |
71
76
72
77
merge :
73
78
runs-on : ubuntu-latest
79
+ if : ${{ github.event_name != 'pull_request' }}
74
80
needs :
75
81
- build
76
82
steps :
@@ -90,10 +96,14 @@ jobs:
90
96
with :
91
97
images : ${{ env.REGISTRY }}/${{ github.repository }}
92
98
tags : |
99
+ type=ref,event=branch
93
100
type=ref,event=tag
101
+ type=ref,event=pr
102
+ type=sha
94
103
type=semver,pattern={{version}}
95
104
96
105
- name : Log into registry ${{ env.REGISTRY }}
106
+ if : github.event_name != 'pull_request'
97
107
uses : docker/login-action@v3
98
108
with :
99
109
registry : ${{ env.REGISTRY }}
@@ -108,4 +118,4 @@ jobs:
108
118
109
119
- name : Inspect image
110
120
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