Skip to content

Commit 82f7be8

Browse files
committed
PP-14301 migrate to central publishing portal
- migrate deployment plugin from ossrh to central publishing portal - streamline `build_and_publish` action - move env values to job level to reduce repetition - delete env var declaration in release step as it is now defined at the job level - remove separate cache step, prefer cache configuration in actions/setup-java
1 parent 1368127 commit 82f7be8

File tree

2 files changed

+16
-29
lines changed

2 files changed

+16
-29
lines changed

.github/workflows/build-and-publish.yml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ jobs:
1818
release:
1919
needs: check-signing-key
2020
runs-on: ubuntu-latest
21+
env:
22+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
23+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
24+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
25+
MAVEN_GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
2126
steps:
2227
- name: Check out Git repository
2328
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -26,17 +31,12 @@ jobs:
2631
with:
2732
java-version: '21'
2833
distribution: 'temurin'
29-
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
30-
server-username: MAVEN_CENTRAL_USERNAME # env variable for username in deploy
31-
server-password: MAVEN_CENTRAL_TOKEN # pragma: allowlist secret - env variable for token in deploy
32-
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
33-
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
34-
- name: Cache Maven packages
35-
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
36-
with:
37-
path: ~/.m2
38-
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
39-
restore-keys: ${{ runner.os }}-m2-
34+
server-id: central
35+
server-username: MAVEN_CENTRAL_USERNAME
36+
server-password: MAVEN_CENTRAL_TOKEN # pragma: allowlist secret
37+
gpg-private-key: MAVEN_GPG_PRIVATE_KEY
38+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
39+
cache: maven
4040
- name: Set package version
4141
id: set-package-version
4242
run: |
@@ -45,10 +45,6 @@ jobs:
4545
mvn -B --no-transfer-progress versions:set -DnewVersion="$PACKAGE_VERSION"
4646
- name: Release Maven package
4747
run: mvn -B --no-transfer-progress deploy -P gpg-sign
48-
env:
49-
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
50-
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
51-
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
5248
- name: Create GitHub release
5349
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
5450
with:

pom.xml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,13 @@
197197
</executions>
198198
</plugin>
199199
<plugin>
200-
<groupId>org.sonatype.plugins</groupId>
201-
<artifactId>nexus-staging-maven-plugin</artifactId>
202-
<version>1.7.0</version>
200+
<groupId>org.sonatype.central</groupId>
201+
<artifactId>central-publishing-maven-plugin</artifactId>
202+
<version>0.8.0</version>
203203
<extensions>true</extensions>
204204
<configuration>
205-
<serverId>ossrh</serverId>
206-
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
207-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
205+
<publishingServerId>central</publishingServerId>
206+
<autoPublish>true</autoPublish>
208207
</configuration>
209208
</plugin>
210209
</plugins>
@@ -240,12 +239,4 @@
240239
</build>
241240
</profile>
242241
</profiles>
243-
244-
<distributionManagement>
245-
<repository>
246-
<id>ossrh</id>
247-
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
248-
</repository>
249-
</distributionManagement>
250-
251242
</project>

0 commit comments

Comments
 (0)