Skip to content

Commit 6175427

Browse files
committed
adding custom build action support
1 parent 0aa67c1 commit 6175427

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

.github/workflows/deploy.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ on:
1111
description: 'Custom run command for the Build and Deploy step (overrides default Maven command)'
1212
required: false
1313
type: string
14+
custom_build_action:
15+
description: 'Custom action reference for build/test (e.g., ./.github/actions/build-and-test or org/repo/.github/actions/name@ref)'
16+
required: false
17+
type: string
18+
custom_build_action_inputs:
19+
description: 'JSON string of inputs to pass to custom build action'
20+
required: false
21+
type: string
22+
custom_deploy_command:
23+
description: 'Custom deploy command to run after custom build action when SHOULD_DEPLOY is true'
24+
required: false
25+
type: string
1426
runs_on:
1527
description: 'Runner to use for the build job (defaults to ubuntu-latest)'
1628
required: false
@@ -126,22 +138,40 @@ jobs:
126138
echo "SHOULD_DEPLOY=$SHOULD_DEPLOY" >> $GITHUB_ENV
127139
echo "Build configuration: BUILD_WITH_DOCS=$BUILD_WITH_DOCS, SHOULD_DEPLOY=$SHOULD_DEPLOY"
128140
141+
- name: Custom build action
142+
if: ${{ inputs.custom_build_action != '' }}
143+
uses: ${{ inputs.custom_build_action }}
144+
with:
145+
java-version: ${{ matrix.java-version }}
146+
inputs: ${{ inputs.custom_build_action_inputs }}
147+
148+
- name: Custom deploy command
149+
if: ${{ inputs.custom_build_action != '' && inputs.custom_deploy_command != '' && env.SHOULD_DEPLOY == 'true' }}
150+
env:
151+
CUSTOM_DEPLOY_COMMAND: ${{ inputs.custom_deploy_command }}
152+
run: |
153+
# Execute custom deploy command after custom build action
154+
echo "Running custom deploy command"
155+
printf '%s\n' "$CUSTOM_DEPLOY_COMMAND" > /tmp/custom-deploy.sh
156+
chmod +x /tmp/custom-deploy.sh
157+
bash /tmp/custom-deploy.sh
158+
129159
- name: Build
130-
if: ${{ inputs.custom_build_command == '' && env.SHOULD_DEPLOY == 'false' }}
160+
if: ${{ inputs.custom_build_action == '' && inputs.custom_build_command == '' && env.SHOULD_DEPLOY == 'false' }}
131161
run: |
132162
# Run Maven install for non-deploying JDK versions (no docs profile needed)
133163
echo "Building without deployment"
134164
./mvnw clean install -Pspring -B -U
135165
136166
- name: Build and deploy
137-
if: ${{ inputs.custom_build_command == '' && env.SHOULD_DEPLOY == 'true' }}
167+
if: ${{ inputs.custom_build_action == '' && inputs.custom_build_command == '' && env.SHOULD_DEPLOY == 'true' }}
138168
run: |
139169
# Run Maven deploy for the designated JDK version (always includes docs profile)
140170
echo "Building with docs profile and deploying artifacts"
141171
./mvnw clean deploy -Pdocs,deploy,spring -B -U
142172
143173
- name: Custom build command
144-
if: ${{ inputs.custom_build_command != '' }}
174+
if: ${{ inputs.custom_build_action == '' && inputs.custom_build_command != '' }}
145175
env:
146176
CUSTOM_BUILD_COMMAND: ${{ inputs.custom_build_command }}
147177
run: |

0 commit comments

Comments
 (0)