Skip to content

Commit

Permalink
Add PGP signing to publications (#403)
Browse files Browse the repository at this point in the history
* Add PGP signing to publications

Introduce Pretty Good Privacy (PGP) signing to the publication workflows of the project. The signing setup is included in the gradle wiring along with the retrieval of the key details from environment variables. This change is applied in both the publish and hotfix workflows.

* Update key retrieval in build script and workflow file

---------

Co-authored-by: Sebastiano Poggi <rock3r@users.noreply.github.com>
  • Loading branch information
lamba92 and rock3r committed Jun 13, 2024
1 parent f96f878 commit 9343c54
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/publish-hotfix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ jobs:
env:
MAVEN_SPACE_USERNAME: ${{secrets.MAVEN_SPACE_USERNAME}}
MAVEN_SPACE_PASSWORD: ${{secrets.MAVEN_SPACE_PASSWORD}}
PGP_PASSWORD: ${{secrets.PGP_PASSWORD}}
PGP_PRIVATE_KEY: ${{secrets.PGP_PRIVATE_KEY}}
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ jobs:
env:
MAVEN_SPACE_USERNAME: ${{secrets.MAVEN_SPACE_USERNAME}}
MAVEN_SPACE_PASSWORD: ${{secrets.MAVEN_SPACE_PASSWORD}}
PGP_PASSWORD: ${{secrets.PGP_PASSWORD}}
PGP_PRIVATE_KEY: ${{secrets.PGP_PRIVATE_KEY}}
11 changes: 11 additions & 0 deletions buildSrc/src/main/kotlin/jewel-publish.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
kotlin("jvm")
`maven-publish`
id("org.jetbrains.dokka")
signing
}

val sourcesJar by tasks.registering(Jar::class) {
Expand All @@ -18,6 +19,16 @@ val javadocJar by tasks.registering(Jar::class) {
destinationDirectory = layout.buildDirectory.dir("artifacts")
}

val publishingExtension = extensions.getByType<PublishingExtension>()

signing {
useInMemoryPgpKeys(
System.getenv("PGP_PRIVATE_KEY") ?: properties["signing.privateKey"] as String?,
System.getenv("PGP_PASSWORD")?: properties["signing.password"] as String?
)
sign(publishingExtension.publications)
}

publishing {
configureJewelRepositories(project)

Expand Down

0 comments on commit 9343c54

Please sign in to comment.