generated from nimblehq/git-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
80 lines (74 loc) · 2.74 KB
/
action.yml
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Build
description: Build with Maven and upload build artifacts
inputs:
use_artifacts:
description: Upload build artifacts
default: 'true'
artifact_name:
description: 'Artifact name. Default: The name of the build and commit hash'
retention_days:
description: Artifact retention days
default: '1'
connected_app_client_id:
description: CloudHub connected app client ID
required: false
connected_app_client_secret:
description: CloudHub connected app client secret
required: false
business_group_id:
description: Business group ID
required: false
nexus_username:
description: Nexus username
required: false
nexus_password:
description: Nexus password
required: false
maven_settings_path:
description: Maven settings file path
required: true
default: .maven/settings.xml
outputs:
artifact_name:
description: Artifact name
value: ${{ steps.stamp_artifact_name.outputs.artifact_name }}
mule_file_path:
description: Mule file path
value: ${{ steps.stamp_artifact_name.outputs.mule_file_path }}
runs:
using: composite
steps:
- name: Increase JAVA HEAP size
shell: bash
run: echo "JAVA_TOOL_OPTIONS=-Xmx5g -Xms1g" >> $GITHUB_ENV
- name: Build with Maven
shell: bash
run: mvn -B package --settings ${{ inputs.maven_settings_path }} --file pom.xml -DskipMunitTests
env:
CONNECTED_APP_CLIENT_ID: ${{ inputs.connected_app_client_id }}
CONNECTED_APP_CLIENT_SECRET: ${{ inputs.connected_app_client_secret }}
BUSINESS_GROUP_ID: ${{ inputs.business_group_id }}
NEXUS_USERNAME: ${{ inputs.nexus_username }}
NEXUS_PASSWORD: ${{ inputs.nexus_password }}
JAVA_TOOL_OPTIONS: ${{ env.JAVA_TOOL_OPTIONS }}
- name: Stamp artifact file name with commit hash
shell: bash
id: stamp_artifact_name
run: |
currentArtifactName=$(ls target/*.jar | head -1)
commitHash=$(git rev-parse --short "$GITHUB_SHA")
newArtifactName=$(ls target/*.jar | head -1 | sed "s/.jar/-$commitHash.jar/g")
mv $currentArtifactName $newArtifactName
echo "mule_file_path=$newArtifactName" >> $GITHUB_OUTPUT
if [ -z "${{ inputs.artifact_name }}" ]; then
echo "artifact_name=$(echo $newArtifactName | cut -d"/" -f2 | sed "s/.jar//g")" >> $GITHUB_OUTPUT
else
echo "artifact_name=${inputs.artifact_name}" >> $GITHUB_OUTPUT
fi
- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: inputs.use_artifacts == 'true'
with:
name: ${{ steps.stamp_artifact_name.outputs.artifact_name }}
path: ${{ steps.stamp_artifact_name.outputs.mule_file_path }}
retention-days: ${{ inputs.retention_days }}