-
Notifications
You must be signed in to change notification settings - Fork 2
113 lines (93 loc) · 2.61 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
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
106
107
108
109
110
111
112
113
name: build
on:
push:
branches:
- '**'
paths-ignore:
- 'LICENSE'
- 'README.adoc'
- 'docs/**'
tags-ignore:
- 'v*'
workflow_dispatch:
jobs:
version:
name: prepare build
runs-on: ubuntu-latest
outputs:
BUILD_VERSION: ${{ env.BUILD_VERSION }}
MAVEN_HOME: ${{ env.MAVEN_HOME }}
steps:
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
- name: checkout
uses: actions/checkout@v4
- name: install dasel
run: |
brew install dasel
cat $GITHUB_ENV
- name: extract version
run: |
version=`dasel -r xml -f pom.xml project.version`
echo "BUILD_VERSION=${version#projectVersion=}" >> $GITHUB_ENV
cat $GITHUB_ENV
- name: find maven home
run: |
maven_home=`./mvnw --version | sed -n '2p' | dasel -r yaml 'Maven home'`
echo "MAVEN_HOME=${maven_home}" >> $GITHUB_ENV
cat $GITHUB_ENV
- name: actor
run: echo ${{ github.actor }} ${{ github.actor == 'hauner' }}
test:
name: test
needs: [version]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: true
- name: set up jdk
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
cache: maven
- name: run tests
run: |
./mvnw --no-transfer-progress verify -D"maven.home=${{ needs.version.outputs.MAVEN_HOME }}"
- name: archive test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results-${{ matrix.os }}
path: 'target/**'
publish:
if: contains(needs.version.outputs.BUILD_VERSION, 'SNAPSHOT') && github.actor == 'hauner'
needs: [version, test]
name: publish snapshot
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: set up jdk
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
server-id: oap-snapshots
server-username: PUBLISH_USER
server-password: PUBLISH_KEY
- name: publish snapshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SIGN_KEY: ${{ secrets.SIGN_KEY_ORG }}
SIGN_KEY_PASS: ${{ secrets.SIGN_PWD }}
PUBLISH_USER: ${{ secrets.PUBLISH_USER }}
PUBLISH_KEY: ${{ secrets.PUBLISH_KEY }}
run: |
./mvnw --no-transfer-progress deploy