Skip to content

Commit

Permalink
build: testing base64 encoded pgp keys
Browse files Browse the repository at this point in the history
  • Loading branch information
janniclas committed Oct 23, 2024
1 parent 8585df5 commit 6e89e9b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USER }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PW }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY_JN }}
ORG_GRADLE_PROJECT_signingKeyEncoded: ${{ secrets.GPG_PRIVATE_KEY_JN }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE_JN }}
run: ./gradlew publish

Expand Down
19 changes: 13 additions & 6 deletions buildSrc/src/main/kotlin/spha-kotlin-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* License-Filename: LICENSE
*/

import java.util.*
import org.gradle.accessors.dm.LibrariesForLibs

private val Project.libs: LibrariesForLibs
Expand Down Expand Up @@ -71,12 +72,18 @@ publishing {
}
}

signing {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications["maven"])
}
fun base64Decode(encodedString: String): String {
return String(Base64.getDecoder().decode(encodedString))
}

val signingKeyEncoded: String? by project

signing {
val signingKey = base64Decode(signingKeyEncoded!!)
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
sign(publishing.publications["maven"])
}

kotlin {
compilerOptions { apiVersion.set(org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0) }
Expand Down

0 comments on commit 6e89e9b

Please sign in to comment.