-
Notifications
You must be signed in to change notification settings - Fork 26
51 lines (49 loc) · 1.6 KB
/
build-java-app-workflow.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
name: Reusable workflow to build Java application
on:
workflow_call:
inputs:
maven_opts:
type: string
required: false
build_folder:
type: string
required: false
default: "build-folder"
outputs:
version:
description: "Project version"
value: ${{ jobs.build-workflow.outputs.version }}
jobs:
build-workflow:
name: Build Java app
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.get_project_version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '10'
- name: Set up JDK 8
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
cache: 'maven'
- name: Install dependencies branches
run: |
if [ -f "./.github/workflows/scripts/get_same_branch.sh" ]; then
chmod +x ./.github/workflows/scripts/get_same_branch.sh
./.github/workflows/scripts/get_same_branch.sh ${{ github.ref_name }}
fi
- name: Maven Build (skip tests)
run: mvn -T 2 clean install -DskipTests ${{ inputs.maven_opts }} --no-transfer-progress
- uses: actions/upload-artifact@v4
with:
name: ${{ inputs.build_folder }}
path: build
- id: get_project_version
name: Get project version
run: |
echo "version=`mvn help:evaluate -q -Dexpression=project.version -DforceStdout`" >> $GITHUB_OUTPUT
- name: test-version-from-check
run: echo "Project version is " ${{ steps.get_project_version.outputs.version }}