77 description : ' Which branch should be built (for workflow_dispatch)'
88 required : false
99 type : string
10+ custom_build_command :
11+ description : ' Custom run command for the Build and Deploy step (overrides default Maven command)'
12+ required : false
13+ type : string
1014 secrets :
1115 ARTIFACTORY_USERNAME :
1216 required : true
@@ -158,9 +162,31 @@ jobs:
158162 java-version : ${{ matrix.java-version }}
159163 distribution : ' temurin'
160164 cache : ' maven'
161- server-id : repo.spring.io
162- server-username : REPO_SPRING_IO_USERNAME
163- server-password : REPO_SPRING_IO_PASSWORD
165+
166+ - name : Configure Maven settings
167+ 168+ with :
169+ servers : |
170+ [{
171+ "id": "repo.spring.io",
172+ "username": "${{ secrets.ARTIFACTORY_USERNAME }}",
173+ "password": "${{ secrets.ARTIFACTORY_PASSWORD }}"
174+ },
175+ {
176+ "id": "spring-commercial-snapshot",
177+ "username": "${{ secrets.COMMERCIAL_ARTIFACTORY_USERNAME }}",
178+ "password": "${{ COMMERCIAL_ARTIFACTORY_PASSWORD }}"
179+ },
180+ {
181+ "id": "spring-commercial-release",
182+ "username": "${{ secrets.COMMERCIAL_ARTIFACTORY_USERNAME }}",
183+ "password": "${{ COMMERCIAL_ARTIFACTORY_PASSWORD }}"
184+ },
185+ {
186+ "id": "spring-commercial-release",
187+ "username": "${{ secrets.COMMERCIAL_ARTIFACTORY_USERNAME }}",
188+ "password": "${{ COMMERCIAL_ARTIFACTORY_PASSWORD }}"
189+ }]
164190
165191 - name : Login to Docker Hub
166192 uses : docker/login-action@v3
@@ -180,13 +206,19 @@ jobs:
180206 run : ./mvnw --version
181207
182208 - name : Build and deploy
183- env :
184- REPO_SPRING_IO_USERNAME : ${{ secrets.ARTIFACTORY_USERNAME }}
185- REPO_SPRING_IO_PASSWORD : ${{ secrets.ARTIFACTORY_PASSWORD }}
186209 run : |
187- if [[ "${{ matrix.java-version }}" == "17" ]]; then
188- ./mvnw clean deploy -Pdocs,deploy,spring -B -U
210+ if [[ -n "${{ inputs.custom_build_command }}" ]]; then
211+ # Write custom command to a script file to support multi-line commands
212+ cat > /tmp/custom-build.sh << CUSTOM_BUILD_EOF
213+ ${{ inputs.custom_build_command }}
214+ CUSTOM_BUILD_EOF
215+ chmod +x /tmp/custom-build.sh
216+ bash /tmp/custom-build.sh
189217 else
190- ./mvnw clean deploy -Pdeploy,spring -B -U
218+ if [[ "${{ matrix.java-version }}" == "17" ]]; then
219+ ./mvnw clean deploy -Pdocs,deploy,spring -B -U
220+ else
221+ ./mvnw clean deploy -Pdeploy,spring -B -U
222+ fi
191223 fi
192224
0 commit comments