Skip to content

Commit c707237

Browse files
authored
Modify CI/CD trigger conditions for the docker job (hellt#12)
* Update cicd.yml so docker job only runs on completed merge * Update cicd.yml to use lists with double quoted strings * Update cicd.yml with repo owner logic
1 parent 93b9ee8 commit c707237

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

.github/workflows/cicd.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
1-
name: Test, Build and Push Docker Image
1+
name: Test, Build, and Push Docker Image
22

3-
"on":
3+
on:
44
push:
55
branches: ["main"]
66
tags:
77
- "v*"
88
pull_request:
9+
branches: ["main"]
10+
release:
11+
types: ["created"]
12+
13+
# GOAL:
14+
# - run test job on pushes to main branch or v* tag
15+
# - run test job on PRs against main branch
16+
# - run test job on Release creation
17+
# - run docker job on the above events when the triggered actor is the repo owner
18+
# - run docker job on Release creation (ex: maybe a maintainer that isn't repo owner)
919

1020
jobs:
1121
test:
@@ -33,6 +43,11 @@ jobs:
3343
packages: write
3444
needs:
3545
- "test"
46+
if: >-
47+
${{
48+
github.triggering_actor == github.repository_owner ||
49+
github.event_name == 'release' && github.event.action == 'created'
50+
}}
3651
steps:
3752
- name: Set up QEMU
3853
uses: docker/setup-qemu-action@v3

0 commit comments

Comments
 (0)