Skip to content

Commit e59a27e

Browse files
committed
Add manual deploy trigger with run-time overrides
Allow manual workflow runs from GitHub Actions with a force option and an optional IMAGE_NAME override. This makes it possible to test publish flows without overwriting the real published images tags.
1 parent 7ca4944 commit e59a27e

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

.github/workflows/build.yaml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,21 @@ on:
55
branches: [main]
66
schedule:
77
- cron: "0 00,12 * * *" # Twice a day
8+
workflow_dispatch:
9+
inputs:
10+
force:
11+
description: Force rebuild and republish all image tags
12+
required: false
13+
default: true
14+
type: boolean
15+
image_name:
16+
description: Override image name for this manual run
17+
required: false
18+
default: ""
19+
type: string
820

921
env:
10-
IMAGE_NAME: ${{ vars.IMAGE_NAME || 'nikolaik/python-nodejs' }}
22+
IMAGE_NAME: ${{ inputs.image_name || vars.IMAGE_NAME || 'nikolaik/python-nodejs' }}
1123

1224
jobs:
1325
generate-matrix:
@@ -26,7 +38,7 @@ jobs:
2638
- name: Generate build matrix
2739
id: set-matrix
2840
run: |
29-
FORCE=$(if git log --pretty=format:"%s" HEAD^..HEAD | grep -q '\[force\]'; then echo "--force"; else echo ""; fi)
41+
FORCE=$(if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ inputs.force }}" == "true" ]]; then echo "--force"; elif git log --pretty=format:"%s" HEAD^..HEAD | grep -q '\[force\]'; then echo "--force"; else echo ""; fi)
3042
uv run dpn $FORCE build-matrix --event ${{ github.event_name }}
3143
3244

0 commit comments

Comments
 (0)