Skip to content

Commit 1ca12fb

Browse files
committed
fix: publish to maven central repo
1 parent 19aea91 commit 1ca12fb

2 files changed

Lines changed: 32 additions & 49 deletions

File tree

.github/workflows/release.yml

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,26 @@ jobs:
4444
files: |
4545
staging/*.jar
4646
47-
publish:
48-
needs: build-and-release
49-
runs-on: ubuntu-latest
50-
environment: production
51-
steps:
52-
- uses: actions/checkout@v4
53-
- name: Set up Maven Central Repository
54-
uses: actions/setup-java@v3
55-
with:
56-
java-version: '8'
57-
distribution: 'temurin'
58-
cache: 'maven'
59-
60-
- name: Publish to the Maven Central Repository
61-
uses: samuelmeuli/action-maven-publish@v1
62-
with:
63-
maven_args: '-DskipTests'
64-
gpg_private_key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
65-
gpg_passphrase: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
66-
nexus_username: ${{ secrets.OSSRH_USERNAME }}
67-
nexus_password: ${{ secrets.OSSRH_TOKEN }}
47+
publish:
48+
needs: build-and-release
49+
runs-on: ubuntu-latest
50+
environment: production
51+
steps:
52+
- uses: actions/checkout@v4
53+
- name: Set up JDK 8
54+
uses: actions/setup-java@v4
55+
with:
56+
java-version: '8'
57+
distribution: 'temurin'
58+
cache: 'maven'
59+
server-id: central
60+
server-username: CENTRAL_USERNAME
61+
server-password: CENTRAL_PASSWORD
62+
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
63+
gpg-passphrase: GPG_PASSPHRASE
64+
- name: Deploy to Sonatype Central
65+
run: mvn clean deploy -DskipTests -B
66+
env:
67+
CENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }}
68+
CENTRAL_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
69+
GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}

pom.xml

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -120,20 +120,8 @@
120120
</dependency>
121121

122122

123-
124123
</dependencies>
125124

126-
<distributionManagement>
127-
<snapshotRepository>
128-
<id>ossrh</id>
129-
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
130-
</snapshotRepository>
131-
<repository>
132-
<id>ossrh</id>
133-
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
134-
</repository>
135-
</distributionManagement>
136-
137125
<build>
138126
<plugins>
139127
<plugin>
@@ -153,17 +141,6 @@
153141
</execution>
154142
</executions>
155143
</plugin>
156-
<plugin>
157-
<groupId>org.sonatype.plugins</groupId>
158-
<artifactId>nexus-staging-maven-plugin</artifactId>
159-
<version>1.6.13</version>
160-
<extensions>true</extensions>
161-
<configuration>
162-
<serverId>ossrh</serverId>
163-
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
164-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
165-
</configuration>
166-
</plugin>
167144

168145
<plugin>
169146
<groupId>org.apache.maven.plugins</groupId>
@@ -218,13 +195,17 @@
218195
</gpgArguments>
219196
</configuration>
220197
</plugin>
221-
222198
<plugin>
223-
<groupId>org.apache.maven.plugins</groupId>
224-
<artifactId>maven-surefire-plugin</artifactId>
225-
<version>3.0.0-M7</version>
199+
<groupId>org.sonatype.central</groupId>
200+
<artifactId>central-publishing-maven-plugin</artifactId>
201+
<version>0.4.0</version>
202+
<extensions>true</extensions>
203+
<configuration>
204+
<publishingServerId>central</publishingServerId>
205+
<autoPublish>true</autoPublish>
206+
<waitUntil>published</waitUntil>
207+
</configuration>
226208
</plugin>
227-
228209
</plugins>
229210
</build>
230211

0 commit comments

Comments
 (0)