File tree Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Original file line number Diff line number Diff line change
1
+ name : Publish package to the Maven Central Repository
2
+
3
+ on :
4
+ release :
5
+ types : [created]
6
+
7
+ jobs :
8
+ publish :
9
+ runs-on : ubuntu-latest
10
+ steps :
11
+ - uses : actions/checkout@v2
12
+ - name : Set up Java
13
+ uses : actions/setup-java@v2
14
+ with :
15
+ java-version : ' 11'
16
+ distribution : ' adopt'
17
+ - name : Publish package
18
+ run : ./gradlew -Prelease publishToSonatype closeAndReleaseSonatypeStagingRepository
19
+ env :
20
+ STAGING_PROFILE_ID : ${{ secrets.STAGING_PROFILE_ID }}
21
+ OSSRH_USERNAME : ${{ secrets.OSSRH_USERNAME }}
22
+ OSSRH_PASSWORD : ${{ secrets.OSSRH_PASSWORD }}
23
+ ORG_GRADLE_PROJECT_signingKey : ${{ secrets.SIGNING_KEY }}
24
+ ORG_GRADLE_PROJECT_signingPassword : ${{ secrets.SIGNING_PASSWORD }}
Original file line number Diff line number Diff line change @@ -12,9 +12,9 @@ nexusPublishing {
12
12
packageGroup = GROUP
13
13
repositories {
14
14
sonatype {
15
- stagingProfileId = project . hasProperty (' mavenProfileId' ) ? " $m avenProfileId " : ' '
16
- username = project . hasProperty (' mavenCentralUsername' ) ? " $m avenCentralUsername " : ' '
17
- password = project . hasProperty (' mavenCentralPassword' ) ? " $m avenCentralPassword " : ' '
15
+ stagingProfileId = findProperty (' mavenProfileId' ) ?: System . getenv( " STAGING_PROFILE_ID " )
16
+ username = findProperty (' mavenCentralUsername' ) ?: System . getenv( " OSSRH_USERNAME " )
17
+ password = findProperty (' mavenCentralPassword' ) ?: System . getenv( " OSSRH_PASSWORD " )
18
18
}
19
19
}
20
20
}
Original file line number Diff line number Diff line change @@ -89,5 +89,10 @@ publishing {
89
89
90
90
signing {
91
91
required rootProject. hasProperty(' release' )
92
+ if (rootProject. hasProperty(' signingKey' )) {
93
+ def signingKey = rootProject. findProperty(" signingKey" )
94
+ def signingPassword = rootProject. findProperty(" signingPassword" )
95
+ useInMemoryPgpKeys(signingKey, signingPassword)
96
+ }
92
97
sign publishing. publications. mavenJava
93
98
}
You can’t perform that action at this time.
0 commit comments