Skip to content

Commit 8d946bb

Browse files
committed
initial maven central relese configuraitons
1 parent 0f62a50 commit 8d946bb

File tree

2 files changed

+87
-32
lines changed

2 files changed

+87
-32
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Release to Maven Central
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up Java
15+
uses: actions/setup-java@v4
16+
with:
17+
java-version: '17'
18+
distribution: 'temurin'
19+
cache: 'maven'
20+
server-id: ossrh
21+
server-username: MAVEN_USERNAME
22+
server-password: MAVEN_PASSWORD
23+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
24+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
25+
26+
- name: Build and Test
27+
run: mvn clean verify
28+
29+
- name: Publish to Maven Central
30+
run: |
31+
mvn --batch-mode \
32+
-Prelease \
33+
-Pjavadoc \
34+
deploy
35+
env:
36+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
37+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
38+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

pom.xml

Lines changed: 49 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
<url>https://spring.io</url>
2727
</organization>
2828

29-
<licenses>
30-
<license>
31-
<name>MIT License</name>
32-
<url>http://www.opensource.org/licenses/mit-license.php</url>
33-
</license>
34-
</licenses>
29+
<licenses>
30+
<license>
31+
<name>MIT License</name>
32+
<url>http://www.opensource.org/licenses/mit-license.php</url>
33+
</license>
34+
</licenses>
3535

3636
<developers>
3737
<developer>
@@ -51,13 +51,11 @@
5151
<url>https://github.com/modelcontextprotocol/java-sdk/actions</url>
5252
</ciManagement>
5353
<distributionManagement>
54-
<snapshotRepository>
55-
<id>spring-snapshots</id>
56-
<url>https://repo.spring.io/libs-snapshot-local</url>
57-
<releases>
58-
<enabled>false</enabled>
59-
</releases>
60-
</snapshotRepository>
54+
<repository>
55+
<id>ossrh</id>
56+
<name>Central Repository OSSRH</name>
57+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
58+
</repository>
6159
</distributionManagement>
6260

6361
<properties>
@@ -299,26 +297,45 @@
299297
</build>
300298
</profile>
301299
<profile>
302-
<id>artifactory-staging</id>
303-
<distributionManagement>
304-
<repository>
305-
<id>spring-staging</id>
306-
<url>https://repo.spring.io/libs-staging-local</url>
307-
<snapshots>
308-
<enabled>false</enabled>
309-
</snapshots>
310-
</repository>
311-
</distributionManagement>
312-
</profile>
313-
<profile>
314-
<id>artifactory-milestone</id>
300+
<id>relesae</id>
301+
<build>
302+
<plugins>
303+
<plugin>
304+
<groupId>org.sonatype.central</groupId>
305+
<artifactId>central-publishing-maven-plugin</artifactId>
306+
<version>0.7.0</version>
307+
<extensions>true</extensions>
308+
<configuration>
309+
<publishingServerId>central</publishingServerId>
310+
</configuration>
311+
</plugin>
312+
<plugin>
313+
<groupId>org.apache.maven.plugins</groupId>
314+
<artifactId>maven-gpg-plugin</artifactId>
315+
<version>3.1.0</version>
316+
<executions>
317+
<execution>
318+
<id>sign-artifacts</id>
319+
<phase>verify</phase>
320+
<goals>
321+
<goal>sign</goal>
322+
</goals>
323+
<configuration>
324+
<gpgArguments>
325+
<arg>--pinentry-mode</arg>
326+
<arg>loopback</arg>
327+
</gpgArguments>
328+
</configuration>
329+
</execution>
330+
</executions>
331+
</plugin>
332+
</plugins>
333+
</build>
315334
<distributionManagement>
316335
<repository>
317-
<id>spring-milestones</id>
318-
<url>https://repo.spring.io/libs-milestone-local</url>
319-
<snapshots>
320-
<enabled>false</enabled>
321-
</snapshots>
336+
<id>ossrh</id>
337+
<name>Central Repository OSSRH</name>
338+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
322339
</repository>
323340
</distributionManagement>
324341
</profile>
@@ -365,4 +382,4 @@
365382
</repository>
366383
</repositories>
367384

368-
</project>
385+
</project>

0 commit comments

Comments
 (0)