Skip to content

Commit ca3f1b5

Browse files
committed
chore: modified configs to publish to maven central
1 parent 66db7b9 commit ca3f1b5

2 files changed

Lines changed: 30 additions & 31 deletions

File tree

.github/workflows/publish.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,30 @@ jobs:
1212
packages: write
1313
steps:
1414
- uses: actions/checkout@v4
15-
- uses: actions/setup-java@v4
15+
16+
- name: Set up JDK
17+
uses: actions/setup-java@v4
1618
with:
1719
distribution: 'temurin'
1820
java-version: 21
19-
- name: Publish package
20-
run: mvn --batch-mode deploy
21+
22+
- name: Build with Maven
23+
run: mvn -ntp -B package
24+
25+
- name: Set up Maven Central Repository
26+
uses: actions/setup-java@v4
27+
with:
28+
java-version: 21
29+
distribution: 'temurin'
30+
server-id: central
31+
server-username: MAVEN_USERNAME
32+
server-password: MAVEN_PASSWORD
33+
gpg-private-key: ${{ secrets.CENTRAL_GPG_PRIVATE_KEY }}
34+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
35+
36+
- name: Publish to the Maven Central Repository
37+
run: mvn -ntp -B -DskipTests -Prelease-central deploy
2138
env:
22-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
MAVEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
40+
MAVEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
41+
MAVEN_GPG_PASSPHRASE: ${{ secrets.CENTRAL_GPG_PASS_PHRASE }}

pom.xml

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -223,38 +223,18 @@
223223
</distributionManagement>
224224
</profile>
225225
<profile>
226-
<id>release-ossrh</id>
227-
<distributionManagement>
228-
<snapshotRepository>
229-
<id>ossrh</id>
230-
<name>Central Repository OSSRH (Snapshot)</name>
231-
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
232-
</snapshotRepository>
233-
<repository>
234-
<id>ossrh</id>
235-
<name>Central Repository OSSRH</name>
236-
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
237-
</repository>
238-
</distributionManagement>
226+
<id>release-central</id>
239227
<build>
240228
<plugins>
241229
<plugin>
242-
<groupId>org.sonatype.plugins</groupId>
243-
<artifactId>nexus-staging-maven-plugin</artifactId>
244-
<version>1.7.0</version>
230+
<groupId>org.sonatype.central</groupId>
231+
<artifactId>central-publishing-maven-plugin</artifactId>
232+
<version>0.8.0</version>
245233
<extensions>true</extensions>
246-
<executions>
247-
<execution>
248-
<phase>deploy</phase>
249-
<goals>
250-
<goal>deploy</goal>
251-
</goals>
252-
</execution>
253-
</executions>
254234
<configuration>
255-
<serverId>ossrh</serverId>
256-
<nexusUrl>https://s01.oss.sonatype.org</nexusUrl>
257-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
235+
<publishingServerId>central</publishingServerId>
236+
<tokenAuth>true</tokenAuth>
237+
<autoPublish>true</autoPublish>
258238
</configuration>
259239
</plugin>
260240
<plugin>

0 commit comments

Comments
 (0)