Skip to content

Commit 409ca60

Browse files
committed
OSSRH now requires GPG signing.
Added as a GitHub secret.
1 parent be1e981 commit 409ca60

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

.github/workflows/publish-android-maven-central.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ jobs:
1717
java-version: '11'
1818
distribution: 'adopt'
1919

20+
- name: Import GPG key
21+
run: |
22+
echo "${{ secrets.OSSRH_GPG }}" > private-key.asc
23+
gpg --import --batch private-key.asc
24+
2025
- name: Cache Gradle packages
2126
uses: actions/cache@v2
2227
with:
@@ -35,5 +40,6 @@ jobs:
3540
env:
3641
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
3742
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
43+
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
3844
working-directory: ./src/AndroidClient
3945
run: ./gradlew android:publishAllPublicationsToOSSRHRepository

.github/workflows/publish-client-maven-central.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ jobs:
1717
java-version: '11'
1818
distribution: 'adopt'
1919

20+
- name: Import GPG key
21+
run: |
22+
echo "${{ secrets.OSSRH_GPG }}" > private-key.asc
23+
gpg --import --batch private-key.asc
24+
2025
- name: Cache Gradle packages
2126
uses: actions/cache@v2
2227
with:
@@ -35,5 +40,6 @@ jobs:
3540
env:
3641
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
3742
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
43+
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
3844
working-directory: ./src/AndroidClient
3945
run: ./gradlew client:publishAllPublicationsToOSSRHRepository

src/AndroidClient/android/build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ if (project.hasProperty('versionSuffix')) {
1010
version = "${version}-${versionSuffix}"
1111
}
1212

13+
if (project.hasProperty('signing.keyId') || System.getenv("SIGNING_KEY_ID")) {
14+
println "Signing enabled"
15+
signing {
16+
sign configurations.archives
17+
keyId = project.findProperty("signing.keyId") ?: System.getenv("SIGNING_KEY_ID")
18+
}
19+
} else {
20+
println "Signing disabled"
21+
}
22+
1323
// Specify dependencies
1424
dependencies {
1525
implementation 'com.google.code.gson:gson:2.8.9'

src/AndroidClient/client/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ if (project.hasProperty('versionSuffix')) {
1010
version = "${version}-${versionSuffix}"
1111
}
1212

13+
apply plugin: 'signing'
14+
15+
16+
if (project.hasProperty('signing.keyId') || System.getenv("SIGNING_KEY_ID")) {
17+
println "Signing enabled"
18+
signing {
19+
sign configurations.archives
20+
keyId = project.findProperty("signing.keyId") ?: System.getenv("SIGNING_KEY_ID")
21+
}
22+
} else {
23+
println "Signing disabled"
24+
}
1325

1426
// Specify dependencies
1527
dependencies {

0 commit comments

Comments
 (0)