@@ -217,45 +217,46 @@ jobs:
217217
218218 - name : Set build configuration
219219 run : |
220- # Determine if docs profile should be included based on JDK configuration
221- # Logic: Include docs if (has-jdk8=true AND java-version=8) OR (has-jdk8=false AND java-version=17)
220+ # Determine if docs profile should be included and if artifacts should be deployed
221+ # Logic: Include docs and deploy if (has-jdk8=true AND java-version=8) OR (has-jdk8=false AND java-version=17)
222222 BUILD_WITH_DOCS=false
223+ SHOULD_DEPLOY=false
223224
224225 if [[ ("${{ matrix.has-jdk8 }}" == "true" && "${{ matrix.java-version }}" == "8") ]] || [[ ("${{ matrix.has-jdk8 }}" == "false" && "${{ matrix.java-version }}" == "17") ]]; then
225226 BUILD_WITH_DOCS=true
227+ SHOULD_DEPLOY=true
226228 echo "Docs profile will be included in this build"
229+ echo "This build will deploy artifacts"
227230 else
228231 echo "Docs profile will NOT be included in this build"
232+ echo "This build will NOT deploy artifacts"
229233 fi
230234
231235 echo "BUILD_WITH_DOCS=$BUILD_WITH_DOCS" >> $GITHUB_ENV
232- echo "Build configuration: BUILD_WITH_DOCS=$BUILD_WITH_DOCS"
236+ echo "SHOULD_DEPLOY=$SHOULD_DEPLOY" >> $GITHUB_ENV
237+ echo "Build configuration: BUILD_WITH_DOCS=$BUILD_WITH_DOCS, SHOULD_DEPLOY=$SHOULD_DEPLOY"
238+
239+ - name : Build
240+ if : ${{ inputs.custom_build_command == '' && env.SHOULD_DEPLOY == 'false' }}
241+ run : |
242+ # Run Maven install for non-deploying JDK versions (no docs profile needed)
243+ echo "Building without deployment"
244+ ./mvnw clean install -Pspring -B -U
233245
234246 - name : Build and deploy
247+ if : ${{ inputs.custom_build_command == '' && env.SHOULD_DEPLOY == 'true' }}
248+ run : |
249+ # Run Maven deploy for the designated JDK version (always includes docs profile)
250+ echo "Building with docs profile and deploying artifacts"
251+ ./mvnw clean deploy -Pdocs,deploy,spring -B -U
252+
253+ - name : Custom build command
254+ if : ${{ inputs.custom_build_command != '' }}
235255 env :
236256 CUSTOM_BUILD_COMMAND : ${{ inputs.custom_build_command }}
237257 run : |
238- # Write build command to temporary script file
239- if [[ -n "$CUSTOM_BUILD_COMMAND" ]]; then
240- # Custom build command provided by caller
241- printf '%s\n' "$CUSTOM_BUILD_COMMAND" > /tmp/build-deploy.sh
242- else
243- # Default Maven build command with conditional docs profile
244- cat > /tmp/build-deploy.sh << 'DEFAULT_BUILD_EOF'
245- #!/bin/bash
246- set -e
247-
248- # BUILD_WITH_DOCS is set by the "Set build configuration" step
249- if [[ "$BUILD_WITH_DOCS" == "true" ]]; then
250- echo "Building with docs profile, and deploying docs"
251- ./mvnw clean deploy -Pdocs,deploy,spring -B -U
252- else
253- echo "Will not add docs profile, docs will not be deployed"
254- ./mvnw clean deploy -Pdeploy,spring -B -U
255- fi
256- DEFAULT_BUILD_EOF
257- fi
258-
258+ # Execute custom build command provided by caller
259+ printf '%s\n' "$CUSTOM_BUILD_COMMAND" > /tmp/build-deploy.sh
259260 chmod +x /tmp/build-deploy.sh
260261 bash /tmp/build-deploy.sh
261262
0 commit comments