-
Notifications
You must be signed in to change notification settings - Fork 21
81 lines (81 loc) · 3.12 KB
/
build.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
81
on:
push:
branches:
- main
- develop
- release-*
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
- develop
- release-*
workflow_dispatch:
name: Build and Test Code
jobs:
build-artifacts:
name: Build Java Artifacts
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
with:
token: ${{ github.token }}
submodules: recursive
fetch-depth: 0
# -------------------------
# Java Environment Setup
# -------------------------
- name: Set up Maven
uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f
with:
maven-version: 3.9.3
- name: Set up JDK 11 (build only)
if: ${{ !((github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref_name == 'develop') }}
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
java-version: 11
distribution: 'temurin'
cache: 'maven'
- name: Set up JDK 11 (deploy)
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref_name == 'develop'
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
java-version: 11
distribution: 'temurin'
cache: 'maven'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Initialize CodeQL
if: github.event_name == 'push'
uses: github/codeql-action/init@ddccb873888234080b77e9bc2d4764d5ccaaccf9
with:
languages: java
# -------------------------
# Maven Build
# -------------------------
- name: Build and Test Code
if: ${{ !((github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref_name == 'develop') }}
run: |
mvn -B -e -Prelease -Preporting install
- name: Build, Test and DEPLOY SNAPSHOT Code
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref_name == 'develop'
run: |
mvn -B -e -Pgpg -Prelease -Preporting deploy -Dmaven.deploy.skip=releases
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Perform CodeQL Analysis
if: github.event_name == 'push'
uses: github/codeql-action/analyze@ddccb873888234080b77e9bc2d4764d5ccaaccf9
- name: Test Website
run: |
# this needs to be run as a second build to ensure source is fully generated by the previous step
mvn -B -e -Prelease -Preporting install site site:stage