Skip to content

Commit 86337b0

Browse files
authored
improve: migrate to new release plugin (#343)
Signed-off-by: Attila Mészáros <[email protected]>
1 parent 6744a9c commit 86337b0

File tree

3 files changed

+36
-30
lines changed

3 files changed

+36
-30
lines changed

.github/workflows/master-snapshot-release.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,18 @@ jobs:
3737
- name: Set up Java and Maven
3838
uses: actions/setup-java@v4
3939
with:
40-
distribution: temurin
4140
java-version: 17
41+
distribution: temurin
4242
cache: 'maven'
43-
- name: Release Maven package
44-
uses: samuelmeuli/action-maven-publish@v1
45-
with:
46-
maven_profiles: "release"
47-
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
48-
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
49-
nexus_username: ${{ secrets.OSSRH_USERNAME }}
50-
nexus_password: ${{ secrets.OSSRH_TOKEN }}
43+
server-id: central
44+
server-username: MAVEN_USERNAME
45+
server-password: MAVEN_CENTRAL_TOKEN
46+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
47+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
48+
49+
- name: Publish to Apache Maven Central
50+
run: mvn package deploy -Prelease
51+
env:
52+
MAVEN_USERNAME: ${{ secrets.NEXUS_USERNAME }}
53+
MAVEN_CENTRAL_TOKEN: ${{ secrets.NEXUS_PASSWORD }}
54+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

.github/workflows/release.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,24 @@ jobs:
1515
java-version: 17
1616
distribution: temurin
1717
cache: 'maven'
18+
server-id: central
19+
server-username: MAVEN_USERNAME
20+
server-password: MAVEN_CENTRAL_TOKEN
21+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
22+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
23+
1824
- name: change version to release version
1925
# Assume that RELEASE_VERSION will have form like: "v1.0.1". So we cut the "v"
2026
run: ./mvnw ${MAVEN_ARGS} versions:set -DnewVersion="${RELEASE_VERSION:1}" versions:commit
2127
env:
2228
RELEASE_VERSION: ${{ github.event.release.tag_name }}
23-
- name: Release Maven package
24-
uses: samuelmeuli/action-maven-publish@v1
25-
with:
26-
maven_profiles: "release"
27-
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
28-
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
29-
nexus_username: ${{ secrets.OSSRH_USERNAME }}
30-
nexus_password: ${{ secrets.OSSRH_TOKEN }}
29+
30+
- name: Publish to Apache Maven Central
31+
run: mvn package deploy -Prelease
32+
env:
33+
MAVEN_USERNAME: ${{ secrets.NEXUS_USERNAME }}
34+
MAVEN_CENTRAL_TOKEN: ${{ secrets.NEXUS_PASSWORD }}
35+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
3136

3237
# This is separate job because there were issues with git after release step, was not able to commit changes. See history.
3338
update-working-version:

pom.xml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,6 @@
3535
<url>https://github.com/java-operator-sdk/kubernetes-webhooks-framework/tree/master</url>
3636
</scm>
3737

38-
<distributionManagement>
39-
<snapshotRepository>
40-
<id>ossrh</id>
41-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
42-
</snapshotRepository>
43-
</distributionManagement>
44-
4538
<properties>
4639
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4740
<java.version>17</java.version>
@@ -74,6 +67,7 @@
7467
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
7568
<spotless-maven-plugin.version>2.45.0</spotless-maven-plugin.version>
7669
<spring-boot-dependencies.version>3.4.5</spring-boot-dependencies.version>
70+
<central-publishing-maven-plugin.version>0.8.0</central-publishing-maven-plugin.version>
7771
</properties>
7872

7973
<dependencyManagement>
@@ -343,6 +337,7 @@
343337
<goals>
344338
<goal>jar</goal>
345339
</goals>
340+
<phase>verify</phase>
346341
</execution>
347342
</executions>
348343
</plugin>
@@ -366,16 +361,18 @@
366361
</executions>
367362
</plugin>
368363
<plugin>
369-
<groupId>org.sonatype.plugins</groupId>
370-
<artifactId>nexus-staging-maven-plugin</artifactId>
371-
<version>${nexus-staging-maven-plugin.version}</version>
364+
<groupId>org.sonatype.central</groupId>
365+
<artifactId>central-publishing-maven-plugin</artifactId>
366+
<version>${central-publishing-maven-plugin.version}</version>
372367
<extensions>true</extensions>
373368
<configuration>
374-
<serverId>ossrh</serverId>
375-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
376-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
369+
<publishingServerId>central</publishingServerId>
370+
<tokenAuth>true</tokenAuth>
371+
<autoPublish>true</autoPublish>
372+
<waitUntil>published</waitUntil>
377373
</configuration>
378374
</plugin>
375+
379376
</plugins>
380377
</build>
381378
</profile>

0 commit comments

Comments
 (0)