-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (44 loc) · 1.61 KB
/
publish.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
40
41
42
43
44
45
46
47
48
49
name: Publish to Sonatype
on:
push:
tags:
- '*'
repository_dispatch:
types: [publish]
jobs:
publish:
runs-on: ubuntu-latest
if: github.repository == 'johnsonlee/sandbox'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'
- name: Publish to sonatype
run: |
echo "Create GPG private key"
echo $GPG_KEY_ARMOR | base64 --decode > ${GITHUB_WORKSPACE}/secring.gpg
echo "Publish ${GITHUB_REF} to Sonatype"
./gradlew clean publishToSonatype -S --no-daemon \
-Pversion=${GITHUB_REF/refs\/tags\/v/} \
-POSSRH_USERNAME=${OSSRH_USERNAME} \
-POSSRH_PASSWORD=${OSSRH_PASSWORD} \
-POSSRH_PACKAGE_GROUP=${OSSRH_PACKAGE_GROUP} \
-Psigning.keyId=${GPG_KEY_ID} \
-Psigning.password=${GPG_PASSPHRASE} \
-Psigning.secretKeyRingFile=${GITHUB_WORKSPACE}/secring.gpg
./gradlew closeAndReleaseRepository -S --no-daemon \
-Pversion=${GITHUB_REF/refs\/tags\/v/} \
-POSSRH_USERNAME=${OSSRH_USERNAME} \
-POSSRH_PASSWORD=${OSSRH_PASSWORD} \
-POSSRH_PACKAGE_GROUP=${OSSRH_PACKAGE_GROUP}
env:
GPG_KEY_ARMOR: ${{ secrets.GPG_KEY_ARMOR }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PACKAGE_GROUP: ${{ secrets.OSSRH_PACKAGE_GROUP }}