-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (39 loc) · 1.73 KB
/
publish-to-maven-central.yaml
File metadata and controls
48 lines (39 loc) · 1.73 KB
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
40
41
42
43
44
45
46
47
48
name: Publish to Maven Central
on:
workflow_dispatch:
permissions: read-all
jobs:
publish-to-maven-central:
name: Publish to Maven Central
continue-on-error: true
environment: PublishToMavenCentral
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setting up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'
- name: Cache Gradle and wrapper
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Trigger Gradle publishing task
run: ./gradlew publishReleasePublicationToMavenCentralRepository -Ppublish.repo.credentials.username="${{ secrets.MAVEN_CENTRAL_USERNAME }}" -Ppublish.repo.credentials.password="${{ secrets.MAVEN_CENTRAL_PASSWORD }}" -PsigningInMemoryKey="${{ secrets.SIGNING_IN_MEMORY_KEY }}" -PsigningInMemoryKeyPassword="${{ secrets.SIGNING_IN_MEMORY_KEY_PASSWORD }}"
# More info on this step available at:
# https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/#1-modify-your-ci-script
- name: Sync with Maven Central Repository
run: |
UPLOAD_URL=$(echo "https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/${{ vars.MAVEN_CENTRAL_NAMESPACE }}")
TOKEN=$(echo ${{ secrets.MAVEN_CENTRAL_USERNAME }}:${{ secrets.MAVEN_CENTRAL_PASSWORD }} | base64 -i -)
curl -X POST $UPLOAD_URL -H "Authorization: Bearer $TOKEN"