-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (47 loc) · 1.59 KB
/
pr.yml
File metadata and controls
49 lines (47 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Build
on:
workflow_call:
inputs:
custom_build_command:
description: 'Custom run command for the Build and Deploy step (overrides default Maven command)'
required: false
type: string
secrets:
ARTIFACTORY_USERNAME:
required: false
ARTIFACTORY_PASSWORD:
required: false
jobs:
pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up JDK
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '17'
- name: Cache local Maven repository
uses: actions/cache@v5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: set env variables
env:
RO_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
RO_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
uses: spring-cloud/spring-cloud-github-actions/.github/actions/set-commercial-creds-env-vars@main
- name: Build with Maven
if: ${{ inputs.custom_build_command == '' }}
run: ./mvnw -s .settings.xml clean install -B -U -Pspring
- name: Custom build command
if: ${{ inputs.custom_build_command != '' }}
env:
CUSTOM_BUILD_COMMAND: ${{ inputs.custom_build_command }}
run: |
# Execute custom build command provided by caller
printf '%s\n' "$CUSTOM_BUILD_COMMAND" > /tmp/build-deploy.sh
chmod +x /tmp/build-deploy.sh
bash /tmp/build-deploy.sh