1
1
name : CI
2
2
3
3
on :
4
+ push :
5
+ branches :
6
+ - ' main'
7
+ - ' hotfix**'
4
8
pull_request :
5
- types : [opened, reopened, synchronize, closed ]
9
+ types : [opened, reopened, synchronize]
6
10
paths-ignore : # ignore docs only changes since they use a dedicated workflows: docs.yml
7
11
- ' docs/**'
8
12
- ' mithril-explorer/**'
9
13
- ' .github/workflows/docs.yml'
14
+ branches-ignore :
15
+ - ' hotfix**' # hotfix are handled by the push trigger
10
16
11
17
concurrency :
12
18
group : ci-build-test-${{ github.ref }}
@@ -248,7 +254,7 @@ jobs:
248
254
packages : write
249
255
250
256
env :
251
- PUSH_PACKAGES : ${{ github.event.action == 'closed ' && github.event.pull_request.merged == true && (github.base_ref == 'main' || startsWith('hotfix', github.base_ref )) }}
257
+ PUSH_PACKAGES : ${{ github.event_name == 'push ' && (github.ref == 'refs/heads/ main' || startsWith('refs/heads/ hotfix', github.ref )) }}
252
258
REGISTRY : ghcr.io
253
259
IMAGE_NAME : ${{ github.repository_owner }}/${{ matrix.project }}
254
260
DOCKER_FILE : ./${{ matrix.project }}/Dockerfile.ci
@@ -272,7 +278,7 @@ jobs:
272
278
images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
273
279
tags : |
274
280
unstable
275
- type=raw,value=${{ github.base_ref }}-{{sha}}
281
+ type=raw,value=${{ github.base_ref || github.ref_name }}-{{sha}}
276
282
277
283
- name : Download built artifacts
278
284
uses : actions/download-artifact@v3
@@ -289,7 +295,7 @@ jobs:
289
295
tags : ${{ steps.meta.outputs.tags }}
290
296
291
297
unstable-release :
292
- if : github.event.action == 'closed ' && github.event.pull_request.merged == true && (github.base_ref == 'main' || startsWith('hotfix', github.base_ref ))
298
+ if : github.event_name == 'push ' && (github.ref == 'refs/heads/ main' || startsWith('refs/heads/ hotfix', github.ref ))
293
299
runs-on : ubuntu-22.04
294
300
needs :
295
301
- build
@@ -418,7 +424,7 @@ jobs:
418
424
uses : actions/checkout@v3
419
425
420
426
- name : Get Docker image id
421
- run : echo "DOCKER_IMAGE_ID=${{ github.base_ref }}-$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
427
+ run : echo "DOCKER_IMAGE_ID=${{ github.base_ref || github.ref_name }}-$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
422
428
423
429
- name : Prepare service account credentials
424
430
run : |
@@ -462,7 +468,7 @@ jobs:
462
468
GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform plan --var-file=./env.variables.tfvars
463
469
464
470
- name : Terraform Apply
465
- if : github.event.action == 'closed ' && github.event.pull_request.merged == true && github.base_ref == ' main'
471
+ if : github.event_name == 'push ' && github.ref == 'refs/heads/ main'
466
472
run : |
467
473
GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform apply -auto-approve --var-file=./env.variables.tfvars
468
474
0 commit comments