generated from IBM/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 2
31 lines (31 loc) · 1.34 KB
/
build.yaml
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
name: build
run-name: ${{ github.actor }} triggered module build
on:
workflow_dispatch: # allow to run from Github web UI
push: # see https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#using-a-single-event
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Create settings.xml
run: |
mkdir -p ~/.m2
echo "<settings><servers><server><id>magnolia.enterprise</id><username>${{secrets.MGNL_USERNAME}}</username><password>${{secrets.MGNL_PASSWORD}}</password></server><server><id>magnolia.forge.snapshots</id><username>${{secrets.MGNL_USERNAME}}</username><password>${{secrets.MGNL_PASSWORD}}</password></server></servers></settings>" > ~/.m2/settings.xml
- name: Build PR or branch with Maven
if: ${{ github.base_ref != 'main' }}
run: mvn -B clean verify -DtomcatTest
- name: Build and Deploy main branch with Maven
if: ${{ github.base_ref == 'main' }}
run: mvn -B clean deploy