Skip to content

Commit a1162e1

Browse files
committed
Update GitHub Actions Workflow to modern actions and versions
Support for dependencies in the Sonatype snapshot repository has been removed because the maven-settings-action does not presently support editing the settings.xml produced by the setup-java action. The only historical reason to add the Sonatype snapshot repository was to test with the Acegi Standard Project superpom snapshots. This is usually undertaken on a developer machine and then an Acegi Standard Project superpom is released to Maven Central. As such having GitHub Actions able to perform this testing is largely unnecessary and has been removed for maintenance practicality.
1 parent e5d94cb commit a1162e1

1 file changed

Lines changed: 30 additions & 47 deletions

File tree

.github/workflows/maven.yml

Lines changed: 30 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,20 @@ jobs:
1313

1414
steps:
1515
- name: Check out Git repository
16-
uses: actions/checkout@v2
16+
uses: actions/checkout@v3
1717

1818
- name: Set up Java and Maven
19-
uses: actions/setup-java@v1
19+
uses: actions/setup-java@v3
2020
with:
21+
distribution: zulu
2122
java-version: 11
22-
23-
- name: Add OSSRH to the snapshot repositories list
24-
uses: s4u/maven-settings-action@v2.1.0
25-
with:
26-
sonatypeSnapshots: true
27-
28-
- name: Cache Maven packages
29-
uses: actions/cache@v1
30-
with:
31-
path: ~/.m2
32-
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
23+
cache: maven
3324

3425
- name: Build with Maven
3526
run: mvn -B verify
3627

3728
- name: Upload code coverage to Codecov
38-
uses: codecov/codecov-action@v1
29+
uses: codecov/codecov-action@v3
3930

4031
compatibility-checks:
4132
name: Java ${{ matrix.java }} on ${{ matrix.os }} Compatibility
@@ -48,29 +39,20 @@ jobs:
4839

4940
steps:
5041
- name: Check out Git repository
51-
uses: actions/checkout@v2
42+
uses: actions/checkout@v3
5243

5344
- name: Set up Java and Maven
54-
uses: actions/setup-java@v1
45+
uses: actions/setup-java@v3
5546
with:
47+
distribution: zulu
5648
java-version: ${{ matrix.java }}
57-
58-
- name: Add OSSRH to the snapshot repositories list
59-
uses: s4u/maven-settings-action@v2.1.0
60-
with:
61-
sonatypeSnapshots: true
62-
63-
- name: Cache Maven packages
64-
uses: actions/cache@v1
65-
with:
66-
path: ~/.m2
67-
key: ${{ runner.os }}-${{ matrix.java }}-m2-${{ hashFiles('**/pom.xml') }}
49+
cache: maven
6850

6951
- name: Test with Maven
7052
run: mvn -B test
7153

7254
- name: Upload Surefire reports on test failure
73-
uses: actions/upload-artifact@v1
55+
uses: actions/upload-artifact@v3
7456
if: failure()
7557
with:
7658
name: surefire-test-log
@@ -84,30 +66,31 @@ jobs:
8466

8567
steps:
8668
- name: Check out Git repository
87-
uses: actions/checkout@v2
69+
uses: actions/checkout@v3
8870

8971
- name: Set up Java and Maven
90-
uses: actions/setup-java@v1
72+
uses: actions/setup-java@v3
9173
with:
74+
distribution: zulu
9275
# Java version 8 required due to https://github.com/lmdbjava/lmdbjava/issues/116
9376
java-version: 8
94-
95-
- name: Add OSSRH to the snapshot repositories list
96-
uses: s4u/maven-settings-action@v2.1.0
97-
with:
98-
sonatypeSnapshots: true
99-
100-
- name: Cache Maven packages
101-
uses: actions/cache@v1
102-
with:
103-
path: ~/.m2
104-
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
77+
cache: maven
78+
server-id: ossrh
79+
server-username: MAVEN_USERNAME
80+
server-password: MAVEN_CENTRAL_TOKEN
81+
gpg-private-key: ${{ secrets.gpg_private_key }}
82+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
10583

10684
- name: Publish Maven package
107-
uses: samuelmeuli/action-maven-publish@v1
85+
run: mvn -Possrh-deploy deploy
86+
env:
87+
MAVEN_GPG_PASSPHRASE: ${{ secrets.gpg_passphrase }}
88+
MAVEN_USERNAME: ${{ secrets.nexus_username }}
89+
MAVEN_CENTRAL_TOKEN: ${{ secrets.nexus_password }}
90+
91+
- name: Debug settings.xml
92+
uses: actions/upload-artifact@v3
93+
if: failure()
10894
with:
109-
gpg_private_key: ${{ secrets.gpg_private_key }}
110-
gpg_passphrase: ${{ secrets.gpg_passphrase }}
111-
nexus_username: ${{ secrets.nexus_username }}
112-
nexus_password: ${{ secrets.nexus_password }}
113-
maven_profiles: ossrh-deploy
95+
name: settings.xml
96+
path: $HOME/.m2/settings.xml

0 commit comments

Comments
 (0)