Skip to content

Commit 0c15d41

Browse files
authored
add new trigger (#6)
1 parent 7210741 commit 0c15d41

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

.github/workflows/publish_docker.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
name: Publish Docker Image to GHCR
22

33
on:
4-
workflow_dispatch:
54
push:
65
branches:
76
- main
8-
- release
9-
- dev
107
tags:
118
- 'v*.*.*' # Semantic versioning pattern
9+
pull_request:
10+
# This triggers on any PR, but we filter by source branch in the job
11+
types: [opened, synchronize, reopened]
12+
workflow_dispatch:
1213

1314
permissions:
1415
contents: read
@@ -21,6 +22,16 @@ jobs:
2122
steps:
2223
- uses: actions/checkout@v4
2324

25+
# Only continue for PRs if the source branch is dev or release
26+
- name: Check PR source branch
27+
if: github.event_name == 'pull_request'
28+
run: |
29+
echo "PR source branch: ${{ github.head_ref }}"
30+
if [[ "${{ github.head_ref }}" != "dev" && "${{ github.head_ref }}" != "release" ]]; then
31+
echo "Not a PR from dev or release branch. Skipping workflow."
32+
exit 1
33+
fi
34+
2435
- name: Log in to GHCR
2536
uses: docker/login-action@v3
2637
with:

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,20 @@
77
88
## Github actions
99
10-
Workflows are centraly hosted in EED_Solutions/eed_gha_workflows.
10+
Workflows are centrally hosted in EED_Solutions/eed_gha_workflows.
1111
Please check for more details here.
1212
13+
### Docker Publish Workflow Triggering
14+
15+
The Docker publish workflow (`publish_docker.yml`) is triggered automatically in the following cases:
16+
17+
- **On any push to the `main` branch.**
18+
- **On any tag pushed to the repository that matches semantic versioning (`v*.*.*`).**
19+
- **When a pull request is opened, synchronized, or reopened and the source branch is named `dev` or `release`.**
20+
- Note: The workflow runs for all PRs, but will immediately exit unless the source branch is `dev` or `release`.
21+
22+
This ensures Docker images are only built and published for main releases, version tags, and changes coming from the main development branches.
23+
1324
## Other
1425
1526
Test EED85-machine

0 commit comments

Comments
 (0)