Skip to content

Commit 08e4fc8

Browse files
committed
CI: Update maven plugins and release pipeline - migrate from OSSRH to central publishing
1 parent 5c572cc commit 08e4fc8

File tree

2 files changed

+36
-38
lines changed

2 files changed

+36
-38
lines changed

.github/workflows/release-new-version.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,19 @@ jobs:
2424
with:
2525
java-version: 11
2626
distribution: temurin
27-
server-id: ossrh
28-
server-username: OSSRH_TOKEN_USERNAME
29-
server-password: OSSRH_TOKEN_PASSWORD
27+
server-id: central
28+
server-username: MAVEN_CENTRAL_PUBLISHING_TOKEN_USERNAME
29+
server-password: MAVEN_CENTRAL_PUBLISHING_TOKEN_PASSWORD
3030
gpg-private-key: ${{ secrets.JAVA_NATIVE_PGP_KEY }}
31-
gpg-passphrase: PGP_KEY_PASSPHRASE
3231
- name: Set release version if provided as input
3332
if: github.event.inputs.releaseVersion != ''
3433
run: echo "VERSIONS=-DreleaseVersion=${{ github.event.inputs.releaseVersion }}" >> $GITHUB_ENV
3534
- name: Publish artifacts to Maven Central
3635
run: mvn -B release:prepare release:perform -P package,maven-central-release ${VERSIONS}
3736
env:
38-
OSSRH_TOKEN_USERNAME: ${{ secrets.OSSRH_TOKEN_USERNAME }}
39-
OSSRH_TOKEN_PASSWORD: ${{ secrets.OSSRH_TOKEN_PASSWORD }}
40-
PGP_KEY_PASSPHRASE: ${{ secrets.JAVA_NATIVE_PGP_KEY_PASSPHRASE }}
37+
MAVEN_CENTRAL_PUBLISHING_TOKEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_PUBLISHING_TOKEN_USERNAME }}
38+
MAVEN_CENTRAL_PUBLISHING_TOKEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PUBLISHING_TOKEN_PASSWORD }}
39+
MAVEN_GPG_PASSPHRASE: ${{ secrets.JAVA_NATIVE_PGP_KEY_PASSPHRASE }}
4140
- run: echo "releaseTag=$(git tag --points-at HEAD^)" >> $GITHUB_ENV
4241
- run: echo "releaseVersion=$(echo ${{ env.releaseTag }} | cut -c2-)" >> $GITHUB_ENV
4342
- name: Push changes back to repo
@@ -68,6 +67,7 @@ jobs:
6867
name: ${{ needs.maven-central-release.outputs.releaseVersion }}
6968
tag: ${{ needs.maven-central-release.outputs.releaseTag }}
7069
allowUpdates: true
70+
prerelease: true
7171
artifacts: target/*.jar
7272
token: ${{ secrets.GITHUB_TOKEN }}
7373

pom.xml

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
<cmake.generate.skip>false</cmake.generate.skip>
5050
<javah.skip>false</javah.skip>
5151
<jar.dependencies.skip>true</jar.dependencies.skip>
52+
<update-resources-precompiled.skip>true</update-resources-precompiled.skip>
5253

5354
<!-- dependency versions a-z -->
5455
<dependency.junit.version>4.13.2</dependency.junit.version>
@@ -57,23 +58,22 @@
5758
<dependency.nativelibloader.version>2.5.0</dependency.nativelibloader.version>
5859

5960
<!-- plugin versions a-z -->
60-
<plugin.animalsniffer.version>1.17</plugin.animalsniffer.version>
61-
<plugin.antrun.version>1.8</plugin.antrun.version>
62-
<plugin.assembly.version>3.1.1</plugin.assembly.version>
63-
<plugin.build-helper-maven-version>3.2.0</plugin.build-helper-maven-version>
64-
<plugin.compiler.version>3.8.0</plugin.compiler.version>
65-
<plugin.enforcer.version>3.0.0-M3</plugin.enforcer.version>
66-
<plugin.gpg.version>3.0.1</plugin.gpg.version>
67-
<plugin.jar.version>3.1.1</plugin.jar.version>
68-
<plugin.javadoc.version>3.1.1</plugin.javadoc.version>
61+
<plugin.animalsniffer.version>1.24</plugin.animalsniffer.version>
62+
<plugin.build-helper-maven-version>3.6.0</plugin.build-helper-maven-version>
63+
<plugin.central-publishing.version>0.7.0</plugin.central-publishing.version>
64+
<plugin.maven-antrun.version>3.1.0</plugin.maven-antrun.version>
65+
<plugin.maven-assembly.version>3.7.1</plugin.maven-assembly.version>
66+
<plugin.maven-compiler.version>3.14.0</plugin.maven-compiler.version>
67+
<plugin.maven-enforcer.version>3.5.0</plugin.maven-enforcer.version>
68+
<plugin.maven-gpg.version>3.2.7</plugin.maven-gpg.version>
69+
<plugin.maven-jar.version>3.4.2</plugin.maven-jar.version>
70+
<plugin.maven-javadoc.version>3.11.2</plugin.maven-javadoc.version>
71+
<plugin.maven-release.version>3.1.1</plugin.maven-release.version>
72+
<plugin.maven-source.version>3.3.1</plugin.maven-source.version>
73+
<plugin.maven-surfire.version>3.5.3</plugin.maven-surfire.version>
6974
<plugin.nar.version>3.6.0</plugin.nar.version>
70-
<plugin.nexus-staging.version>1.6.7</plugin.nexus-staging.version>
71-
<plugin.osmaven.version>1.7.0</plugin.osmaven.version>
72-
<plugin.release.version>3.0.0-M4</plugin.release.version>
75+
<plugin.osmaven.version>1.7.1</plugin.osmaven.version>
7376
<plugin.signature.version>1.1</plugin.signature.version>
74-
<plugin.source.version>3.0.1</plugin.source.version>
75-
<plugin.surfire.version>3.0.0-M4</plugin.surfire.version>
76-
<update-resources-precompiled.skip>true</update-resources-precompiled.skip>
7777
</properties>
7878

7979
<dependencies>
@@ -123,18 +123,18 @@
123123
<plugin>
124124
<groupId>org.apache.maven.plugins</groupId>
125125
<artifactId>maven-compiler-plugin</artifactId>
126-
<version>${plugin.compiler.version}</version>
126+
<version>${plugin.maven-compiler.version}</version>
127127
</plugin>
128128
<plugin>
129129
<groupId>org.apache.maven.plugins</groupId>
130130
<artifactId>maven-javadoc-plugin</artifactId>
131-
<version>${plugin.javadoc.version}</version>
131+
<version>${plugin.maven-javadoc.version}</version>
132132
</plugin>
133133

134134
<plugin>
135135
<groupId>org.apache.maven.plugins</groupId>
136136
<artifactId>maven-source-plugin</artifactId>
137-
<version>${plugin.source.version}</version>
137+
<version>${plugin.maven-source.version}</version>
138138
</plugin>
139139

140140
</plugins>
@@ -168,7 +168,7 @@
168168
<plugin>
169169
<groupId>org.apache.maven.plugins</groupId>
170170
<artifactId>maven-enforcer-plugin</artifactId>
171-
<version>${plugin.enforcer.version}</version>
171+
<version>${plugin.maven-enforcer.version}</version>
172172
<executions>
173173
<execution>
174174
<id>recommended-jdk</id>
@@ -215,7 +215,7 @@
215215
<plugin>
216216
<groupId>org.apache.maven.plugins</groupId>
217217
<artifactId>maven-antrun-plugin</artifactId>
218-
<version>${plugin.antrun.version}</version>
218+
<version>${plugin.maven-antrun.version}</version>
219219
<executions>
220220

221221
<execution>
@@ -297,7 +297,7 @@
297297
<plugin>
298298
<groupId>org.apache.maven.plugins</groupId>
299299
<artifactId>maven-surefire-plugin</artifactId>
300-
<version>${plugin.surfire.version}</version>
300+
<version>${plugin.maven-surfire.version}</version>
301301
<configuration>
302302
<!-- Separate JVMs between classes; Needed for "jssc.boot.library.path" test to be effective -->
303303
<reuseForks>false</reuseForks>
@@ -311,7 +311,7 @@
311311
<plugin>
312312
<groupId>org.apache.maven.plugins</groupId>
313313
<artifactId>maven-jar-plugin</artifactId>
314-
<version>${plugin.jar.version}</version>
314+
<version>${plugin.maven-jar.version}</version>
315315
</plugin>
316316

317317
<plugin>
@@ -332,7 +332,7 @@
332332
<plugin>
333333
<groupId>org.apache.maven.plugins</groupId>
334334
<artifactId>maven-assembly-plugin</artifactId>
335-
<version>${plugin.assembly.version}</version>
335+
<version>${plugin.maven-assembly.version}</version>
336336

337337
<executions>
338338
<execution>
@@ -647,7 +647,7 @@
647647
<plugin>
648648
<groupId>org.apache.maven.plugins</groupId>
649649
<artifactId>maven-gpg-plugin</artifactId>
650-
<version>${plugin.gpg.version}</version>
650+
<version>${plugin.maven-gpg.version}</version>
651651
<executions>
652652
<execution>
653653
<id>sign-artifacts</id>
@@ -659,7 +659,6 @@
659659
</executions>
660660
<configuration>
661661
<keyname>java-native</keyname>
662-
<passphraseServerId>gpg.passphrase</passphraseServerId>
663662
<gpgArguments>
664663
<arg>--pinentry-mode</arg>
665664
<arg>loopback</arg>
@@ -669,7 +668,7 @@
669668
<plugin>
670669
<groupId>org.apache.maven.plugins</groupId>
671670
<artifactId>maven-release-plugin</artifactId>
672-
<version>${plugin.release.version}</version>
671+
<version>${plugin.maven-release.version}</version>
673672
<configuration>
674673
<tagNameFormat>v@{project.version}</tagNameFormat>
675674
<pushChanges>false</pushChanges>
@@ -678,13 +677,12 @@
678677
</configuration>
679678
</plugin>
680679
<plugin>
681-
<groupId>org.sonatype.plugins</groupId>
682-
<artifactId>nexus-staging-maven-plugin</artifactId>
683-
<version>${plugin.nexus-staging.version}</version>
680+
<groupId>org.sonatype.central</groupId>
681+
<artifactId>central-publishing-maven-plugin</artifactId>
682+
<version>${plugin.central-publishing.version}</version>
684683
<extensions>true</extensions>
685684
<configuration>
686-
<serverId>ossrh</serverId>
687-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
685+
<publishingServerId>central</publishingServerId>
688686
</configuration>
689687
</plugin>
690688
</plugins>

0 commit comments

Comments
 (0)