Skip to content

Commit

Permalink
github workflow yaml to publish package to the Maven Central Repository
Browse files Browse the repository at this point in the history
  • Loading branch information
homebeaver committed Feb 2, 2023
1 parent 453b775 commit 95dbd66
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/maven.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# The name of workflow. GitHub displays the names on repository's actions page.
# If omitted, GitHub sets it to the workflow file path relative to the root of the repository.
# see: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions
name: Publish package to the Maven Central Repository

# Triggered when code is pushed to any branch in a repository
#on: push
# Triggers the workflow on push or pull request events
#on: [push, pull_request]
# Triggers on event release with type created
on:
release:
types: [created]

jobs:
publish:

runs-on: ubuntu-latest
# continue-on-error: ${{ matrix.experimental }}
# strategy:
# matrix:
# java: [ 8, 11, 16 ]
# experimental: [false]
# include:
# - java: 17-ea
# experimental: true
strategy:
matrix:
java: [ 16 ]

steps:
- uses: actions/checkout@v3
- name: Set up Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: '16'
distribution: 'adopt'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish package
# run: mvn -V --batch-mode -Ddoclint=all --file pom.xml --no-transfer-progress deploy
run: mvn -V --batch-mode deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
Expand Down

0 comments on commit 95dbd66

Please sign in to comment.