Skip to content

Commit

Permalink
OSSRH now requires GPG signing.
Browse files Browse the repository at this point in the history
Added as a GitHub secret.
  • Loading branch information
Layoric committed Oct 11, 2023
1 parent be1e981 commit 409ca60
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/publish-android-maven-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ jobs:
java-version: '11'
distribution: 'adopt'

- name: Import GPG key
run: |
echo "${{ secrets.OSSRH_GPG }}" > private-key.asc
gpg --import --batch private-key.asc
- name: Cache Gradle packages
uses: actions/cache@v2
with:
Expand All @@ -35,5 +40,6 @@ jobs:
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
working-directory: ./src/AndroidClient
run: ./gradlew android:publishAllPublicationsToOSSRHRepository
6 changes: 6 additions & 0 deletions .github/workflows/publish-client-maven-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ jobs:
java-version: '11'
distribution: 'adopt'

- name: Import GPG key
run: |
echo "${{ secrets.OSSRH_GPG }}" > private-key.asc
gpg --import --batch private-key.asc
- name: Cache Gradle packages
uses: actions/cache@v2
with:
Expand All @@ -35,5 +40,6 @@ jobs:
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
working-directory: ./src/AndroidClient
run: ./gradlew client:publishAllPublicationsToOSSRHRepository
10 changes: 10 additions & 0 deletions src/AndroidClient/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ if (project.hasProperty('versionSuffix')) {
version = "${version}-${versionSuffix}"
}

if (project.hasProperty('signing.keyId') || System.getenv("SIGNING_KEY_ID")) {
println "Signing enabled"
signing {
sign configurations.archives
keyId = project.findProperty("signing.keyId") ?: System.getenv("SIGNING_KEY_ID")
}
} else {
println "Signing disabled"
}

// Specify dependencies
dependencies {
implementation 'com.google.code.gson:gson:2.8.9'
Expand Down
12 changes: 12 additions & 0 deletions src/AndroidClient/client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ if (project.hasProperty('versionSuffix')) {
version = "${version}-${versionSuffix}"
}

apply plugin: 'signing'


if (project.hasProperty('signing.keyId') || System.getenv("SIGNING_KEY_ID")) {
println "Signing enabled"
signing {
sign configurations.archives
keyId = project.findProperty("signing.keyId") ?: System.getenv("SIGNING_KEY_ID")
}
} else {
println "Signing disabled"
}

// Specify dependencies
dependencies {
Expand Down

0 comments on commit 409ca60

Please sign in to comment.