-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (102 loc) · 3.5 KB
/
ci-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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: CI build
# Run this workflow every time a new commit pushed to your repository
on:
push:
branches: [ '**' ]
tags-ignore: [ '**' ]
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup GPG
if: env.GPG_SECRET_KEYS != null && env.GPG_OWNERTRUST != null
run: |
cat <(echo -e "${{ env.GPG_SECRET_KEYS }}") | base64 --decode | gpg --batch --import
cat <(echo -e "${{ env.GPG_OWNERTRUST }}") | base64 --decode | gpg --batch --import-ownertrust
env:
GPG_SECRET_KEYS: ${{ secrets.GPG_SECRET_KEYS }}
GPG_OWNERTRUST: ${{ secrets.GPG_OWNERTRUST }}
- name: Setup Graphviz
run: sudo apt-get install graphviz
- name: Set up JDK 8 for compiling Java 5 compatible bytecode
id: setup-java-8
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 8
java-package: jdk
- name: Set up JDK to support jigsaw module system
id: setup-java-17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
java-package: jdk
- name: Setup maven cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-repo-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-repo-
- name: Perform build
run: .github/scripts/build.sh
shell: bash
env:
JAVA_8_HOME: ${{ steps.setup-java-8.outputs.path }}
JAVA_17_HOME: ${{ steps.setup-java-17.outputs.path }}
MAVEN_CLI_OPTS: --settings .github/mvn-settings.xml --global-toolchains .github/mvn-toolchains.xml
GPG_EXECUTABLE: /usr/bin/gpg
GPG_KEYNAME: ${{ secrets.GPG_KEYNAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
- name: Publish test coverage
if: env.COVERALLS_REPO_TOKEN != null
run: ./mvnw --batch-mode -DrepoToken=${{ env.COVERALLS_REPO_TOKEN }} jacoco:report coveralls:report
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
release:
name: "Release"
runs-on: ubuntu-latest
needs: build
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- name: Check out code
if: env.GH_TOKEN != null
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ env.GH_TOKEN }}
- name: Set up CI git user
if: env.GH_TOKEN != null
run: |
git config user.name "Talsma CI"
git config user.email "ci-user@talsma-ict.nl"
- name: Set up JDK
if: env.GH_TOKEN != null
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 17
java-package: jdk
- name: Set up maven cache
if: env.GH_TOKEN != null
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-repo-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-repo-
- name: Perform optional release
if: env.GH_TOKEN != null
run: .github/scripts/release.sh
shell: bash
env:
MAVEN_CLI_OPTS: --settings .github/mvn-settings.xml