-
Notifications
You must be signed in to change notification settings - Fork 5
39 lines (36 loc) · 1.46 KB
/
callable.publish-sonatype.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Publish to Sonatype (Maven Central)
on:
workflow_call:
jobs:
publish:
name: gradle publish (Maven Central)
runs-on: ubuntu-latest
steps:
- name: Checkout project sources
uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '21'
- uses: gradle/actions/wrapper-validation@v3
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3.5.0
with:
cache-read-only: true
# note the following two steps are identical but different names for better DX in GitHub Actions UI
- name: Publish SNAPSHOT to Sonatype (Maven Central)
if: github.ref == 'refs/heads/main'
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GPG_SIGNING_PASSPHRASE: ${{ secrets.GPG_SIGNING_PASSPHRASE }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
- name: Publish RELEASE to Sonatype (Maven Central)
if: github.ref_type == 'tag'
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GPG_SIGNING_PASSPHRASE: ${{ secrets.GPG_SIGNING_PASSPHRASE }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}