Skip to content

Commit 0ab9328

Browse files
committed
Simplify GitHub workflows when using Maven commands
1 parent cf020ca commit 0ab9328

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

.github/workflows/java-ea-maven.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
- develop
77
workflow_dispatch:
88

9+
env:
10+
MAVEN_ARGS: "-B -ntp"
11+
912
jobs:
1013
build-and-test-job:
1114
strategy:
@@ -33,8 +36,8 @@ jobs:
3336

3437
- name: Build and (headless) test with Maven (Linux)
3538
if: ${{ runner.os == 'Linux' }}
36-
run: xvfb-run mvn -U -B -ntp verify
39+
run: xvfb-run mvn -U verify
3740

3841
- name: Build and (headless) test with Maven (Windows and macOS)
3942
if: ${{ runner.os != 'Linux' }}
40-
run: mvn -U -B -ntp verify
43+
run: mvn -U verify

.github/workflows/java8-maven.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Java8+ with Maven
22

33
on: [ push, pull_request ]
44

5+
env:
6+
MAVEN_ARGS: "-B -ntp"
7+
58
jobs:
69
build-and-test-job:
710
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/heads/develop') || startsWith(github.ref, 'refs/tags/v')
@@ -31,17 +34,17 @@ jobs:
3134
- name: Pre-download dependencies with Maven
3235
uses: nick-fields/retry@v3
3336
with:
34-
command: mvn -U -B -ntp dependency:go-offline
37+
command: mvn -U dependency:go-offline
3538
max_attempts: 3
3639
timeout_minutes: 5
3740

3841
- name: Build and (headless) test with Maven (Linux)
3942
if: ${{ runner.os == 'Linux' }}
40-
run: xvfb-run mvn -U -B -ntp verify
43+
run: xvfb-run mvn -U verify
4144

4245
- name: Build and (headless) test with Maven (Windows and macOS)
4346
if: ${{ runner.os != 'Linux' }}
44-
run: mvn -U -B -ntp verify
47+
run: mvn -U verify
4548

4649
auto-merge-job:
4750
needs: build-and-test-job
@@ -90,15 +93,15 @@ jobs:
9093
cache: 'maven'
9194

9295
- name: Deploy snapshot with Maven if settings defined
93-
run: test ! -f ci.settings.xml || mvn -B -ntp deploy -DskipTests -s ci.settings.xml -P base-deploy,snapshot-deploy,!non-deployable-modules
96+
run: test ! -f ci.settings.xml || mvn deploy -DskipTests -s ci.settings.xml -P base-deploy,snapshot-deploy,!non-deployable-modules
9497
env:
9598
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
9699
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
97100
SIGN_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
98101
SIGN_KEY_PASS: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
99102

100103
- name: Dryrun release assets with Maven
101-
run: mvn -B -ntp install -DskipTests -P full-release -Djreleaser.output.directory=$PWD/out/jreleaser -Djreleaser.dry.run
104+
run: mvn install -DskipTests -P full-release -Djreleaser.output.directory=$PWD/out/jreleaser -Djreleaser.dry.run
102105
env:
103106
JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }}
104107
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.MAVEN_GPG_PUBLIC_KEY }}
@@ -140,7 +143,7 @@ jobs:
140143
cache: 'maven'
141144

142145
- name: Deploy with Maven if settings defined
143-
run: test ! -f ci.settings.xml || mvn -B -ntp deploy -DskipTests -s ci.settings.xml -P base-deploy,release-deploy,!non-deployable-modules
146+
run: test ! -f ci.settings.xml || mvn deploy -DskipTests -s ci.settings.xml -P base-deploy,release-deploy,!non-deployable-modules
144147
env:
145148
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
146149
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
@@ -150,7 +153,7 @@ jobs:
150153
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"
151154

152155
- name: Release assets with Maven
153-
run: mvn -B -ntp install -DskipTests -P full-release -Djreleaser.output.directory=$PWD/out/jreleaser
156+
run: mvn install -DskipTests -P full-release -Djreleaser.output.directory=$PWD/out/jreleaser
154157
env:
155158
JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }}
156159
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.MAVEN_GPG_PUBLIC_KEY }}

0 commit comments

Comments
 (0)