-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: deploy to Sonatype automatically
Signed-off-by: Mariell Hoversholm <[email protected]>
- Loading branch information
Mariell Hoversholm
committed
Dec 3, 2021
1 parent
b307790
commit ae12248
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Deploy to Sonatype OSSRH | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: JDK ${{ matrix.java }} | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
distribution: temurin | ||
# Cache omitted on purpose: we want a _clean_ build. | ||
- name: Test | ||
run: ./gradlew test --no-daemon | ||
|
||
deploy: | ||
# We don't want to attempt deployment before we know tests pass. | ||
needs: [test] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: temurin | ||
- name: Deploy to OSSRH | ||
run: ./gradlew publish | ||
env: | ||
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} | ||
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} | ||
- name: Deploy to Central | ||
if: ${{ github.ref_type == 'tag' }} | ||
run: ./gradlew closeAndReleaseSonatypeStagingRepository | ||
env: | ||
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} | ||
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} |