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 a8b2943 commit a12897c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 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 }}
16 changes: 9 additions & 7 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,19 +59,18 @@
<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>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<maven.compiler.release>8</maven.compiler.release>
<jakarta-api.version>2.3.3</jakarta-api.version>
<jaxb.version>2.3.8</jaxb.version>
<jaxb.plugin.version>2.0.9</jaxb.plugin.version>
Expand Down Expand Up @@ -318,8 +317,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 +381,9 @@
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>ossrh</flattenMode>
<pomElements>
<build>remove</build>
</pomElements>
</configuration>
<executions>
<execution>
Expand Down

0 comments on commit a12897c

Please sign in to comment.