-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (60 loc) · 2.09 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Publish to Maven Central
on:
release:
types: [ created ]
jobs:
publish:
name: Publish Release Artifacts
runs-on: ubuntu-latest
steps:
# Step 1
# This is optional and only if you want to set the timezone
- name: Setup timezone
run: |
sudo timedatectl set-timezone Europe/Oslo
timedatectl
# Step 2
# Reguired step
- name: Check out the repo
uses: actions/checkout@v4
# Step 3
# Optional step
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2
# Step 4
# Reguired step
- name: Set up Java 17 JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
architecture: x64
cache: 'gradle'
check-latest: true
# Step 5
# Optional step, but recommended as user often commit the gradle wrapper jar without exevute permissions.
- name: Change wrapper permissions
run: chmod +x ./gradlew
# Step 6
# Reguired step
- name: Decode GPG Key
run: |
mkdir -p ~/.gradle/
echo "${{secrets.OSSRH_GPG_SECRET_KEY}}" > ~/.gradle/secring.gpg.b64
base64 -d ~/.gradle/secring.gpg.b64 > ~/.gradle/secring.gpg
# Step 7
# Obviously reguired step
- name: Publish package
# wraped the signing.password with single quotes as the password could contain special characters
run: ./gradlew publish -Psigning.keyId=${{secrets.OSSRH_GPG_SECRET_KEY_ID}} -Psigning.password='${{secrets.OSSRH_GPG_SECRET_KEY_PASSWORD}}' -Psigning.secretKeyRingFile=$(echo ~/.gradle/secring.gpg) --warn --stacktrace
env:
OSSRH_USERNAME: ${{secrets.OSSRH_USERNAME}}
OSSRH_PASSWORD: ${{secrets.OSSRH_PASSWORD}}
# Step 8
# Optional step, will enable you to see what you have released as well here on GitHub
# - name: Upload Artifacts
# uses: actions/upload-artifact@v4
# with:
# name: release-build-libs
# path: build/libs
# retention-days: 3