-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (65 loc) · 2.36 KB
/
common-backend.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
name: Reusable backend workflow
on:
workflow_call:
inputs:
app-name:
description: "Application name"
required: true
type: string
with-wkhtmltopdf:
description: "Should wkhtmltopdf be installed or not"
required: false
type: boolean
default: false
env:
BACKEND_DIR: ./backend
jobs:
common-backend:
if: ${{ contains(github.event.head_commit.message, inputs.app-name) || contains(github.ref, 'snyk-io') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/cache@v3
with:
path: ${{ env.BACKEND_DIR }}/${{ inputs.app-name }}/src/main/resources/static
key: ${{ runner.os }}-${{ inputs.app-name }}-frontend-build-${{ github.sha }}
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
- uses: szenius/[email protected]
with:
timezoneLinux: "Europe/Helsinki"
- name: Install wkhtmltopdf
if: inputs.with-wkhtmltopdf
run: |
echo 'Updating apt-get package information'
sudo apt-get update
echo 'Installing wkhtmltopdf'
sudo apt-get install wkhtmltopdf
echo 'Installed wkhtmltopdf, check that it works'
wkhtmltopdf --version
echo 'Installation of wkhtmltopdf completed'
shell: bash
- name: Prepare maven settings
uses: s4u/maven-settings-action@v2
with:
servers: '[{"id": "oph-github-packages", "username": "${GITHUB_USERNAME}", "password": "${GITHUB_REGISTRY_TOKEN}"}]'
- name: Build with Maven
working-directory: ${{ env.BACKEND_DIR }}/${{ inputs.app-name }}
run: mvn clean install -Dplugin.prettier.goal=check
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_REGISTRY_TOKEN: ${{ github.token }}
- uses: actions/cache@v3
with:
path: ${{ env.BACKEND_DIR }}/${{ inputs.app-name }}/target/${{ inputs.app-name }}-*.jar
key: ${{ runner.os }}-${{ inputs.app-name }}-backend-build-${{ github.sha }}