36
36
deploy-sign-docker-image : ${{ fromJson(steps.config.outputs.config).deploy.sign-docker-image }}
37
37
deploy-pre-release-matrix : ${{ steps.pre-release-matrix.outputs.matrix }}
38
38
deploy-release-matrix : ${{ steps.release-matrix.outputs.matrix }}
39
+ is-forked : ${{ github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name }}
39
40
steps :
40
41
- name : Checkout
41
42
uses : actions/checkout@v3
@@ -149,6 +150,8 @@ jobs:
149
150
150
151
release :
151
152
runs-on : ubuntu-latest
153
+ permissions :
154
+ contents : write
152
155
needs :
153
156
- config
154
157
- build
@@ -175,6 +178,7 @@ jobs:
175
178
run : mv application.tar.gz ${{ github.event.repository.name }}.tar.gz
176
179
177
180
- name : Create release
181
+ if : ${{ env.FORKED == 'false' }}
178
182
uses : softprops/action-gh-release@v1
179
183
id : create-release
180
184
with :
@@ -190,6 +194,10 @@ jobs:
190
194
191
195
deploy :
192
196
name : deploy-[${{ matrix.name }}]
197
+ permissions :
198
+ contents : write
199
+ packages : write
200
+ pull-requests : write
193
201
runs-on : ubuntu-latest
194
202
strategy :
195
203
max-parallel : 1
@@ -224,28 +232,33 @@ jobs:
224
232
make oci.pc download-rpms
225
233
226
234
- name : Build image
235
+ id : docker-meta
227
236
env :
228
237
VERSION : " ${{ needs.release.outputs.version }}"
229
- run : make ${{ matrix.name }}-image
238
+ run : |
239
+ make ${{ matrix.name }}-image
240
+ TAG_SUFFIX=$(echo "-${{ matrix.name }}" | sed s/-ubuntu//)
241
+ echo "image-id=$IMAGE_NAME" >> $GITHUB_OUTPUT
242
+ echo "image-version=${VERSION}${TAG_SUFFIX}" >> $GITHUB_OUTPUT
230
243
231
244
- name : Log in to registry
245
+ if : ${{ env.FORKED == 'false' }}
232
246
run : echo "${{ secrets.GITHUB_TOKEN }}" | docker login ${{ env.REGISTRY }} -u $ --password-stdin
233
247
234
248
- name : Push image
235
- id : docker-meta
249
+ if : ${{ env.FORKED == 'false' }}
236
250
env :
237
251
VERSION : " ${{ needs.release.outputs.version }}"
238
252
run : |
239
253
make push-${{ matrix.name }}-image
240
- TAG_SUFFIX=$(echo "-${{ matrix.name }}" | sed s/-ubuntu//)
241
- echo "image-id=$IMAGE_NAME" >> $GITHUB_OUTPUT
242
- echo "image-version=${VERSION}${TAG_SUFFIX}" >> $GITHUB_OUTPUT
243
254
244
255
- name : Format current time
256
+ if : ${{ env.FORKED == 'false' }}
245
257
id : time_now
246
258
run : echo "time_now_formatted=$(date +'%Y-%m-%d %H:%M:%S')" >> "$GITHUB_OUTPUT"
247
259
248
260
- name : Find releases comment
261
+ if : ${{ env.FORKED == 'false' }}
249
262
uses : peter-evans/find-comment@v2
250
263
id : find_comment
251
264
with :
@@ -255,7 +268,7 @@ jobs:
255
268
256
269
- name : Create releases comment
257
270
uses : peter-evans/create-or-update-comment@v2
258
- if : ${{ steps.find_comment.outputs.comment-id == '' }}
271
+ if : ${{ steps.find_comment.outputs.comment-id == '' && env.FORKED == 'false' }}
259
272
with :
260
273
comment-id : ${{ steps.find_comment.outputs.comment-id }}
261
274
issue-number : ${{ github.event.pull_request.number }}
@@ -269,7 +282,7 @@ jobs:
269
282
270
283
- name : Append releases comment
271
284
uses : peter-evans/create-or-update-comment@v2
272
- if : ${{ steps.find_comment.outputs.comment-id != '' }}
285
+ if : ${{ steps.find_comment.outputs.comment-id != '' && env.FORKED == 'false' }}
273
286
with :
274
287
comment-id : ${{ steps.find_comment.outputs.comment-id }}
275
288
issue-number : ${{ github.event.pull_request.number }}
@@ -278,16 +291,16 @@ jobs:
278
291
| ${{ steps.time_now.outputs.time_now_formatted }} | **${{ steps.docker-meta.outputs.image-version }}** |
279
292
280
293
- name : Setup cosign
281
- if : ${{ needs.config.outputs.deploy-sign-docker-image == 'true' }}
294
+ if : ${{ needs.config.outputs.deploy-sign-docker-image == 'true' && env.FORKED == 'false' }}
282
295
uses : sigstore/cosign-installer@main
283
296
284
297
- name : Write signing key to disk (only needed for `cosign sign --key`)
285
- if : ${{ needs.config.outputs.deploy-sign-docker-image == 'true' }}
298
+ if : ${{ needs.config.outputs.deploy-sign-docker-image == 'true' && env.FORKED == 'false' }}
286
299
continue-on-error : true
287
300
run : echo "${{ secrets.SIGNING_SECRET }}" > cosign.key
288
301
289
302
- name : Sign the published Docker image
290
- if : ${{ needs.config.outputs.deploy-sign-docker-image == 'true' }}
303
+ if : ${{ needs.config.outputs.deploy-sign-docker-image == 'true' && env.FORKED == 'false' }}
291
304
continue-on-error : true
292
305
env :
293
306
COSIGN_PASSWORD : " "
@@ -314,7 +327,12 @@ jobs:
314
327
315
328
comments :
316
329
runs-on : ubuntu-latest
330
+ if : ${{ needs.config.outputs.is-forked == 'false' }}
331
+ permissions :
332
+ contents : write
333
+ pull-requests : write
317
334
needs :
335
+ - config
318
336
- release
319
337
steps :
320
338
- name : Format current time
0 commit comments