Skip to content

Commit 403c205

Browse files
authored
fix: handle trigger package workflow (#21)
1 parent 6b3d3b0 commit 403c205

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

.github/workflows/package.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,24 @@ name: package
33
on:
44
push:
55
tags:
6-
- '[0-9]+.[0-9]+.[0-9]+'
6+
- '*.*.*'
77
workflow_dispatch:
8+
# Run the workflow when the Release workflow completes
9+
workflow_run:
10+
workflows: ['Release']
11+
types:
12+
- completed
813

914
jobs:
1015
build:
1116
runs-on: ubuntu-latest
17+
# Trigger the job only if the Release Tagging job was successful or manually triggered
18+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event.workflow_run.conclusion == 'success' || github.event.ref == 'refs/heads/main' }}
19+
20+
env:
21+
# Only push the image if the new tag is pushed or manually triggered
22+
PUSH_CONDITION: ${{ startsWith(github.ref, 'refs/tags/') || github.event.workflow_run.conclusion == 'success' || github.ref == 'refs/heads/main' }}
23+
1224
steps:
1325
- name: Checkout
1426
uses: actions/checkout@v4
@@ -38,7 +50,7 @@ jobs:
3850
- name: Push Release
3951
uses: docker/build-push-action@v5
4052
with:
41-
push: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/next' }}
53+
push: ${{ env.PUSH_CONDITION }}
4254
tags: ${{ steps.meta.outputs.tags }}
4355
labels: ${{ steps.meta.outputs.labels }}
4456
build-args: |

0 commit comments

Comments
 (0)