Repository navigation
175 lines (146 loc) · 5.95 KB
/
Copy pathjava-maven.yml
File metadata and controls
175 lines (146 loc) · 5.95 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
name: ⚡ Java with Maven
on: [ push, pull_request ]
env:
MAVEN_ARGS: "-B -ntp"
JAVA_VERSION: 21
jobs:
validate-job:
name: 🔍 Validation
runs-on: ubuntu-latest
steps:
- name: ⚙️ Checkout and Setup Maven
uses: s4u/setup-maven-action@v1.22.0
with:
checkout-submodules: true
checkout-fetch-depth: 0
java-version: ${{ env.JAVA_VERSION }}
- name: ☕ Validate project with Maven
run: mvn validate
build-and-test-job:
needs: validate-job
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/v')
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-15-intel, macos-latest, windows-latest ]
name: 🧪 Tests on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: ⚙️ Checkout and Setup Maven
uses: s4u/setup-maven-action@v1.22.0
with:
checkout-submodules: true
checkout-fetch-depth: 0
java-version: ${{ env.JAVA_VERSION }}
- name: ☕ Pre-download dependencies with Maven
run: mvn -U dependency:go-offline
- name: ☕ Build and (headless) test with Maven
run: ${{ runner.os == 'Linux' && 'xvfb-run' || '' }} mvn install
auto-merge-job:
needs: build-and-test-job
if: github.event.repository.fork == false && github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
permissions:
contents: write
pull-requests: write
name: 🤖 Merge on dependabot PR
runs-on: ubuntu-latest
steps:
- name: 🔀 Merge PR
uses: nick-fields/retry@v4
with:
command: gh pr merge --auto --rebase "$PR_URL"
max_attempts: 3
timeout_minutes: 5
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
dry-run-job:
needs: build-and-test-job
if: github.event.repository.fork == false && github.ref == 'refs/heads/develop'
name: 🚀 Dry-run on develop
runs-on: ubuntu-latest
steps:
- name: ⚙️ Checkout and Setup Maven
uses: s4u/setup-maven-action@v1.22.0
with:
checkout-submodules: true
checkout-fetch-depth: 0
java-version: ${{ env.JAVA_VERSION }}
- name: ☕ Dry-run deploy with Maven if settings defined
run: test ! -f ci.settings.xml || mvn deploy -DskipTests -P base-deploy "-DaltDeploymentRepository=dryrun::file:$PWD/out/deploy"
env:
MAVEN_GPG_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: ☕ Dry-run release assets with Maven
run: mvn install -DskipTests -P full-release "-Djreleaser.output.directory=$PWD/out/jreleaser" -Djreleaser.dry.run
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.MAVEN_GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: ⬆️ Upload JReleaser output
if: always()
uses: actions/upload-artifact@v7
with:
name: assets-dry-run-log
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties
mark-tested-job:
needs: dry-run-job
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
permissions:
contents: write
concurrency:
group: mark-tested
name: 🏷️ Mark as tested
runs-on: ubuntu-latest
steps:
- name: ⚙️ Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: 🏷️ Move ci/tested tag
run: |
if git rev-parse -q --verify refs/tags/ci/tested >/dev/null && git merge-base --is-ancestor HEAD ci/tested; then
echo "::notice::ci/tested already contains $GITHUB_SHA; not moved"
exit 0
fi
git tag -f ci/tested
git push -f origin refs/tags/ci/tested
release-job:
needs: build-and-test-job
if: github.event.repository.fork == false && startsWith(github.ref, 'refs/tags/v')
name: 🚀 Release on tag
runs-on: ubuntu-latest
steps:
- name: ⚙️ Checkout and Setup Maven
uses: s4u/setup-maven-action@v1.22.0
with:
checkout-submodules: true
checkout-fetch-depth: 0
java-version: ${{ env.JAVA_VERSION }}
- name: ☕ Deploy with Maven if settings defined
run: test ! -f ci.settings.xml || mvn deploy -DskipTests -Dmaven.repository.credentialScope=id -s ci.settings.xml -P base-deploy,release-deploy
env:
CENTRAL_PORTAL_USERNAME: ${{ secrets.CENTRAL_PORTAL_USERNAME }}
CENTRAL_PORTAL_TOKEN: ${{ secrets.CENTRAL_PORTAL_TOKEN }}
MAVEN_GPG_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
# Fix https://issues.sonatype.org/browse/OSSRH-66257
MAVEN_OPTS: "--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED"
- name: ☕ Release assets with Maven
run: mvn install -DskipTests -P full-release "-Djreleaser.output.directory=$PWD/out/jreleaser"
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.MAVEN_GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: ⬆️ Upload JReleaser output
if: always()
uses: actions/upload-artifact@v7
with:
name: assets-release-log
path: |
out/jreleaser/trace.log
out/jreleaser/output.properties