-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (71 loc) · 2.17 KB
/
publish.yml
File metadata and controls
74 lines (71 loc) · 2.17 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# ---------------------------------------------------------------
# workflow: publish
#
# Perform on all release:create events
#
# Signs and published artifacts to Maven Central
#
on:
workflow_call:
inputs:
java-version:
default: '21'
description: JDK version
required: false
type: string
java-distribution:
default: 'corretto'
description: JDK distribution
required: false
type: string
dry-run:
default: false
description: If true, only publish locally
required: false
type: boolean
ref:
description: Ref to release from
required: false
type: string
secrets:
OSSRH_USERNAME:
required: true
OSSRH_TOKEN:
required: true
GPG_SIGNING_KEY_BASE64:
required: true
GPG_SIGNING_PASSPHRASE:
required: true
name: publish
jobs:
publish:
name: 'Publish Release'
runs-on: ubuntu-latest
steps:
- name: log
run: |
echo "${{ github.ref }}"
echo "${{ inputs.ref }}"
- uses: actions/checkout@v3
with:
ref: ${{ inputs.ref || github.ref }}
- name: Set up JDK ${{ inputs.java-version }} (${{ inputs.java-distribution }})
uses: actions/setup-java@v3
with:
java-version: ${{ inputs.java-version }}
distribution: ${{ inputs.java-distribution }}
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- if: ${{ inputs.dry-run }}
name: Publish Release (Local)
run: ./gradlew publishToMavenLocal
- if: ${{ !inputs.dry-run }}
name: Publish Release (Maven Central)
run: |
export ORG_GRADLE_PROJECT_signingKey=$(echo -n "$GPG_SIGNING_KEY_BASE64" | base64 -d)
./gradlew publishToCentral closeAndReleaseCentralStagingRepository
env:
ORG_GRADLE_PROJECT_ossrhUserName: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_ossrhToken: ${{ secrets.OSSRH_TOKEN }}
GPG_SIGNING_KEY_BASE64: ${{ secrets.GPG_SIGNING_KEY_BASE64 }}
ORG_GRADLE_PROJECT_signingKeyPassword: ${{ secrets.GPG_SIGNING_PASSPHRASE }}