-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (54 loc) · 1.6 KB
/
veracode-build-java-maven.yml
File metadata and controls
58 lines (54 loc) · 1.6 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
50
51
52
53
54
55
56
57
58
name: Veracode Build Java Maven Application
on:
workflow_call:
inputs:
repository:
required: true
type: string
ref:
required: true
type: string
token:
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
token: ${{ inputs.token }}
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: oracle
- name: Cache Maven Dependencies
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
- name: Build with Maven
run: mvn clean package
- name: Identify the Artifact
id: identify
run: |
jar_files=$(find target -name "*.jar" -type f -maxdepth 1 -exec basename {} \;)
war_files=$(find target -name "*.war" -type f -maxdepth 1 -exec basename {} \;)
ear_files=$(find target -name "*.ear" -type f -maxdepth 1 -exec basename {} \;)
if [ ! -z "$jar_files" ]; then
artifact_file=$jar_files
elif [ ! -z "$war_files" ]; then
artifact_file=$war_files
elif [ ! -z "$ear_files" ]; then
artifact_file=$ear_files
else
echo "no files found"
fi
echo $artifact_file
echo "veracode_artifact=$artifact_file" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3
with:
name: veracode-artifact
path: target/${{ env.veracode_artifact }}