Skip to content

Commit

Permalink
add maven central release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
bertramn committed Oct 8, 2023
1 parent ca81600 commit 5b3eb05
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/maven-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
name: Publish package to the Maven Central Repository
on:
release:
types: [ created ]
push:
branches:
- main
- develop
- releases/**

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Maven Central
uses: actions/setup-java@v3
with:
java-version: 17
distribution: corretto
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish Package
run: mvn --batch-mode --no-transfer-progress clean deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
13 changes: 8 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<email>niels.bertram@fares.io</email>
<url>https://plus.google.com/+NielsBertram</url>
<organization>fares.io</organization>
<organizationUrl>http://fares.io/</organizationUrl>
<organizationUrl>https://fares.io/</organizationUrl>
</developer>
</developers>

Expand All @@ -59,11 +59,11 @@
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

Expand Down Expand Up @@ -318,8 +318,8 @@
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -382,6 +382,9 @@
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>ossrh</flattenMode>
<pomElements>
<build>remove</build>
</pomElements>
</configuration>
<executions>
<execution>
Expand Down

0 comments on commit 5b3eb05

Please sign in to comment.