Skip to content

Commit 24dfc4e

Browse files
authored
Merge pull request #56 from JesseMckinzie/maven_publishing
Add Maven publishing to Github actions
2 parents 80eb0e0 + 90c0fbb commit 24dfc4e

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Publish package to the Maven Central Repository
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- name: Set up Maven Central Repository
11+
uses: actions/setup-java@v3
12+
with:
13+
java-version: 11
14+
distribution: 'temurin'
15+
server-id: ossrh
16+
server-username: MAVEN_USERNAME
17+
server-password: MAVEN_PASSWORD
18+
- name: build artifact
19+
run: mvn -B package --file pom.xml -DskipTests
20+
- name: Publish package
21+
run: mvn --batch-mode deploy
22+
env:
23+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
24+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}

pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
<maven.compiler.target>1.7</maven.compiler.target>
1212
</properties>
1313

14+
<distributionManagement>
15+
<repository>
16+
<id>ossrh</id>
17+
<name>Central Repository OSSRH</name>
18+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
19+
</repository>
20+
</distributionManagement>
21+
1422
<dependencies>
1523

1624
<dependency>

0 commit comments

Comments
 (0)