Skip to content

Commit

Permalink
Use environment variables to assign signatory details.
Browse files Browse the repository at this point in the history
  • Loading branch information
Layoric committed Oct 12, 2023
1 parent 46644cd commit 2925689
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/publish-android-maven-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSSRH_GPG_KEY }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
working-directory: ./src/AndroidClient
run: ./gradlew android:publishAllPublicationsToOSSRHRepository
4 changes: 2 additions & 2 deletions .github/workflows/publish-client-maven-central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSSRH_GPG_KEY }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
working-directory: ./src/AndroidClient
run: ./gradlew client:publishAllPublicationsToOSSRHRepository
11 changes: 6 additions & 5 deletions src/AndroidClient/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,15 @@ publishing {
}
}

// Check if the environment variables are set
def signingKey = System.getenv('SIGNING_KEY')
def signingPassword = System.getenv('SIGNING_PASSWORD')


if (findProperty('signingKeyId')) {
// Conditionally apply the signing plugin and configuration
if (signingKey && signingPassword) {
println "Signing enabled"
signing {
def signingKeyId = findProperty("signingKeyId")
def signingKey = findProperty("signingKey")
useInMemoryPgpKeys(signingKeyId, signingKey, null)
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}
} else {
Expand Down
11 changes: 7 additions & 4 deletions src/AndroidClient/client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,15 @@ publishing {
}
}

if (findProperty('signingKeyId')) {
// Check if the environment variables are set
def signingKey = System.getenv('SIGNING_KEY')
def signingPassword = System.getenv('SIGNING_PASSWORD')

// Conditionally apply the signing plugin and configuration
if (signingKey && signingPassword) {
println "Signing enabled"
signing {
def signingKeyId = findProperty("signingKeyId")
def signingKey = findProperty("signingKey")
useInMemoryPgpKeys(signingKeyId, signingKey, null)
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}
} else {
Expand Down

0 comments on commit 2925689

Please sign in to comment.