|
11 | 11 | description: 'Custom run command for the Build and Deploy step (overrides default Maven command)' |
12 | 12 | required: false |
13 | 13 | 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 |
14 | 26 | runs_on: |
15 | 27 | description: 'Runner to use for the build job (defaults to ubuntu-latest)' |
16 | 28 | required: false |
@@ -126,22 +138,40 @@ jobs: |
126 | 138 | echo "SHOULD_DEPLOY=$SHOULD_DEPLOY" >> $GITHUB_ENV |
127 | 139 | echo "Build configuration: BUILD_WITH_DOCS=$BUILD_WITH_DOCS, SHOULD_DEPLOY=$SHOULD_DEPLOY" |
128 | 140 |
|
| 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 | +
|
129 | 159 | - 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' }} |
131 | 161 | run: | |
132 | 162 | # Run Maven install for non-deploying JDK versions (no docs profile needed) |
133 | 163 | echo "Building without deployment" |
134 | 164 | ./mvnw clean install -Pspring -B -U |
135 | 165 |
|
136 | 166 | - 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' }} |
138 | 168 | run: | |
139 | 169 | # Run Maven deploy for the designated JDK version (always includes docs profile) |
140 | 170 | echo "Building with docs profile and deploying artifacts" |
141 | 171 | ./mvnw clean deploy -Pdocs,deploy,spring -B -U |
142 | 172 |
|
143 | 173 | - name: Custom build command |
144 | | - if: ${{ inputs.custom_build_command != '' }} |
| 174 | + if: ${{ inputs.custom_build_action == '' && inputs.custom_build_command != '' }} |
145 | 175 | env: |
146 | 176 | CUSTOM_BUILD_COMMAND: ${{ inputs.custom_build_command }} |
147 | 177 | run: | |
|
0 commit comments