Repository navigation
209 lines (184 loc) · 5.79 KB
/
Copy pathci.yml
File metadata and controls
209 lines (184 loc) · 5.79 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
name: CI
on:
push:
branches:
- master
tags:
- "v*"
pull_request:
branches:
- master
permissions:
contents: read
concurrency:
group: ${{ github.ref_name }}-ci
cancel-in-progress: true
jobs:
release-notes:
name: Create/Update release notes
permissions:
contents: write
runs-on: ubuntu-24.04
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Checkout Repository
uses: actions/checkout@v7
- name: Create/Update Draft
uses: lucacome/draft-release@v2.2.1
with:
minor-label: "enhancement"
major-label: "change"
publish: ${{ github.ref_type == 'tag' }}
collapse-after: 50
license:
name: License header check
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Java
uses: actions/setup-java@v6
with:
distribution: temurin
java-version: '11'
cache: maven
- name: Check license headers
run: make license-check
test:
name: Test
runs-on: ubuntu-24.04
needs: license
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
# needed by license-maven-plugin, which inspects git history
fetch-depth: 0
persist-credentials: false
- name: Set up Java
uses: actions/setup-java@v6
with:
distribution: temurin
java-version: '11'
cache: maven
- name: Build and test
run: ./mvnw clean install
- name: Submit dependency graph
uses: advanced-security/maven-dependency-submission-action@v5
if: github.event_name == 'push'
classpath:
name: Classpath (${{ matrix.profile }})
runs-on: ubuntu-24.04
needs: license
strategy:
fail-fast: false
matrix:
profile: [nodeps, alldeps]
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
# needed by license-maven-plugin, which inspects git history
fetch-depth: 0
persist-credentials: false
- name: Set up Java
uses: actions/setup-java@v6
with:
distribution: temurin
java-version: '11'
cache: maven
- name: Install dependencies
run: ./mvnw install -DskipTests=true -Dmaven.javadoc.skip=true -B -V
- name: Run classpath tests
run: make PROFILES=${{ matrix.profile }} classpath
publish:
name: Publish to Maven Central
needs: [test, classpath]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
env:
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Java
uses: actions/setup-java@v6
with:
distribution: temurin
java-version: '11'
cache: maven
mvn-server-credentials: |
central:CENTRAL_USERNAME:CENTRAL_TOKEN
github:GITHUB_ACTOR:GITHUB_TOKEN
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase-env-var: GPG_PASSPHRASE
- name: Verify tag matches pom version
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
POM_VERSION=$(./mvnw help:evaluate -N -Dexpression=project.version -q -DforceStdout | grep -v '\[')
echo "Tag version: $TAG_VERSION"
echo "POM version: $POM_VERSION"
if [[ "$POM_VERSION" != "$TAG_VERSION" ]]; then
echo "::error::Tag $TAG_VERSION does not match pom $POM_VERSION"
echo "::warning::Tag $TAG_VERSION does not match pom $POM_VERSION (expected if release:prepare not used with v prefix))"
exit 1
fi
- name: Publish to GitHub Packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./mvnw --batch-mode -Pgithub -DskipTests deploy
- name: Publish release to Maven Central
if: ${{ env.CENTRAL_USERNAME != '' }}
env:
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: ./mvnw --batch-mode -Prelease -DskipTests deploy
snapshot:
name: Publish snapshot
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: ubuntu-24.04
needs: [test, classpath]
permissions:
contents: read
packages: write
env:
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Java
uses: actions/setup-java@v6
with:
distribution: temurin
java-version: '11'
cache: maven
mvn-server-credentials: |
central:CENTRAL_USERNAME:CENTRAL_TOKEN
github:GITHUB_ACTOR:GITHUB_TOKEN
- name: Publish snapshot to GitHub Packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./mvnw --batch-mode -Pgithub -DskipTests deploy
- name: Publish snapshot to Maven Central
if: ${{ env.CENTRAL_USERNAME != '' }}
env:
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }}
run: ./mvnw --batch-mode -DskipTests deploy