Skip to content

Commit

Permalink
base64 encode the signing key
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Jul 3, 2024
1 parent 9c3578d commit 63a3da6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ jobs:
run: |
./gradlew -Pflavor=Sp build install \
--console=plain \
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
-PsigningKeyEncoded='${{ secrets.SIGNING_KEY_ENCODED }}' \
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}'
- name: gradlew -Pflavor=Sp release
if: startsWith(github.ref, 'refs/tags/')
run: |
./gradlew -Pflavor=Sp release \
--console=plain \
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
-PsigningKeyEncoded='${{ secrets.SIGNING_KEY_ENCODED }}' \
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}' \
-PossrhPassword='${{ secrets.OSSRH_PASSWORD }}' \
-PossrhUsername='${{ secrets.OSSRH_USERNAME }}'
Expand All @@ -47,14 +47,14 @@ jobs:
run: |
./gradlew -Ptarget=MacOSX64 run build install \
--console=plain \
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
-PsigningKeyEncoded='${{ secrets.SIGNING_KEY_ENCODED }}' \
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}'
- name: gradlew -Ptarget=MacOSX64 release
if: startsWith(github.ref, 'refs/tags/')
run: |
./gradlew -Ptarget=MacOSX64 release \
--console=plain \
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
-PsigningKeyEncoded='${{ secrets.SIGNING_KEY_ENCODED }}' \
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}' \
-PossrhPassword='${{ secrets.OSSRH_PASSWORD }}' \
-PossrhUsername='${{ secrets.OSSRH_USERNAME }}'
Expand All @@ -72,14 +72,14 @@ jobs:
run: |
./gradlew -Ptarget=MacOSX_ARM64 build install \
--console=plain \
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
-PsigningKeyEncoded='${{ secrets.SIGNING_KEY_ENCODED }}' \
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}'
- name: gradlew -Ptarget=MacOSX_ARM64 release
if: startsWith(github.ref, 'refs/tags/')
run: |
./gradlew -Ptarget=MacOSX_ARM64 release \
--console=plain \
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
-PsigningKeyEncoded='${{ secrets.SIGNING_KEY_ENCODED }}' \
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}' \
-PossrhPassword='${{ secrets.OSSRH_PASSWORD }}' \
-PossrhUsername='${{ secrets.OSSRH_USERNAME }}'
Expand All @@ -97,15 +97,15 @@ jobs:
run: |
./gradlew build install \
--console=plain \
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
-PsigningKeyEncoded='${{ secrets.SIGNING_KEY_ENCODED }}' \
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}'
shell: bash
- name: gradlew release
if: startsWith(github.ref, 'refs/tags/')
run: |
./gradlew release \
--console=plain \
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
-PsigningKeyEncoded='${{ secrets.SIGNING_KEY_ENCODED }}' \
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}' \
-PossrhPassword='${{ secrets.OSSRH_PASSWORD }}' \
-PossrhUsername='${{ secrets.OSSRH_USERNAME }}'
Expand All @@ -124,14 +124,14 @@ jobs:
run: |
./gradlew -Pflavor=Dp build install \
--console=plain \
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
-PsigningKeyEncoded='${{ secrets.SIGNING_KEY_ENCODED }}' \
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}'
- name: gradlew -Pflavor=Dp release
if: startsWith(github.ref, 'refs/tags/')
run: |
./gradlew -Pflavor=Dp release \
--console=plain \
-PsigningKey='${{ secrets.SIGNING_KEY }}' \
-PsigningKeyEncoded='${{ secrets.SIGNING_KEY_ENCODED }}' \
-PsigningPassword='${{ secrets.SIGNING_PASSWORD }}' \
-PossrhPassword='${{ secrets.OSSRH_PASSWORD }}' \
-PossrhUsername='${{ secrets.OSSRH_USERNAME }}'
17 changes: 13 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -366,23 +366,32 @@ publishMavenPublicationToMavenLocal.doLast {
// Register signing tasks:

// Signing relies on the existence of 2 properties
// (signingKey and signingPassword)
// (signingKeyEncoded and signingPassword)
// which should be stored in ~/.gradle/gradle.properties
// or passed in the command line

signing {
def signingKey = project.findProperty('signingKey')
def signingPassword = project.findProperty('signingPassword')
def signingKey = base64Decode(findProperty("signingKeyEncoded"))
def signingPassword = findProperty('signingPassword')
useInMemoryPgpKeys(signingKey, signingPassword)

sign configurations.archives
sign publishing.publications.maven
}
tasks.withType(Sign) {
onlyIf { project.hasProperty('signingKey') }
onlyIf { project.hasProperty('signingKeyEncoded') }
}
signMavenPublication.dependsOn('module')

def base64Decode(encodedString){
if (encodedString != null) {
byte[] decoded = encodedString.decodeBase64()
String decode = new String(decoded)
return decode
}
return null;
}

// Download and extract archived JoltPhysics source code

tasks.register('downloadJoltSource', Download) {
Expand Down

0 comments on commit 63a3da6

Please sign in to comment.