Skip to content

Commit 78bc9f9

Browse files
committed
Update Maven workflow and versioning for publishing to Maven Central
1 parent e21a58a commit 78bc9f9

File tree

2 files changed

+21
-25
lines changed

2 files changed

+21
-25
lines changed

.github/workflows/maven--package-publish.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Publishing to Maven Packages
22
#on: [ push ] # Trigger the workflow when a push (commit) event occurs
33
on:
4+
push:
5+
branches:
6+
- fix/workflow-release
47
release:
58
types: [ created ]
69
jobs:
@@ -24,8 +27,8 @@ jobs:
2427
- name: Publish to Maven Central Repository
2528
run: mvn --batch-mode -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} deploy
2629
env:
27-
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
28-
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
30+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
31+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
2932
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
3033

3134
# run: mvn --batch-mode deploy

pom.xml

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66
<groupId>com.contentstack.sdk</groupId>
77
<artifactId>java</artifactId>
8-
<version>2.2.0</version>
8+
<version>2.2.1-beta</version>
99
<packaging>jar</packaging>
1010
<name>contentstack-java</name>
1111
<description>Java SDK for Contentstack Content Delivery API</description>
@@ -85,26 +85,24 @@
8585
</developer>
8686
</developers>
8787

88-
<distributionManagement>
88+
<!-- <distributionManagement>
8989
90-
<!-- Maven Snapshot Repository -->
90+
Maven Snapshot Repository
9191
<snapshotRepository>
9292
<id>ossrh</id>
9393
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
9494
</snapshotRepository>
95-
96-
<!--GitHub Packages-->
97-
<!-- <snapshotRepository>-->
98-
<!-- <id>github</id>-->
99-
<!-- <url>https://maven.pkg.github.com/contentstack/contentstack-java</url>-->
100-
<!-- </snapshotRepository>-->
101-
<!--Maven Release Repository-->
95+
<snapshotRepository>
96+
<id>github</id>
97+
<url>https://maven.pkg.github.com/contentstack/contentstack-java</url>
98+
</snapshotRepository>
99+
Maven Release Repository
102100
<repository>
103101
<id>ossrh</id>
104102
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
105103
</repository>
106104
107-
</distributionManagement>
105+
</distributionManagement> -->
108106

109107

110108
<dependencies>
@@ -278,7 +276,7 @@
278276
<artifactId>maven-surefire-plugin</artifactId>
279277
<version>2.22.2</version>
280278
<configuration>
281-
<skipTests>true</skipTests>
279+
<!-- <skipTests>true</skipTests> -->
282280
</configuration>
283281
</plugin>
284282

@@ -328,19 +326,14 @@
328326
</plugin>
329327

330328
<plugin>
331-
<groupId>org.sonatype.plugins</groupId>
332-
<artifactId>nexus-staging-maven-plugin</artifactId>
333-
<version>${nexus-staging-maven-plugin.version}</version>
329+
<groupId>org.sonatype.central</groupId>
330+
<artifactId>central-publishing-maven-plugin</artifactId>
331+
<version>0.8.0</version> <!-- or latest -->
334332
<extensions>true</extensions>
335-
<!-- <configuration>-->
336-
<!-- <serverId>github</serverId>-->
337-
<!-- <nexusUrl>https://maven.pkg.github.com/contentstack/contentstack-java</nexusUrl>-->
338-
<!-- <autoReleaseAfterClose>true</autoReleaseAfterClose>-->
339-
<!-- </configuration>-->
340333
<configuration>
341-
<serverId>ossrh</serverId>
342-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
343-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
334+
<publishingServerId>central</publishingServerId>
335+
<autoPublish>true</autoPublish>
336+
<waitUntil>published</waitUntil>
344337
</configuration>
345338
</plugin>
346339
<!--

0 commit comments

Comments
 (0)