Skip to content

Commit

Permalink
SNAPSHOTs #n
Browse files Browse the repository at this point in the history
  • Loading branch information
martinbonnin committed Feb 19, 2024
1 parent 8c5e9c1 commit 2259266
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: gradle/gradle-build-action@v2
- run: ./gradlew publishIfNeeded
- name: publish artifacts
run: ./gradlew publishIfNeeded
env:
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
OSSRH_USER: ${{ secrets.OSSRH_USER }}
Expand Down
34 changes: 15 additions & 19 deletions build-logic/src/main/kotlin/internal/publishing.kt
Original file line number Diff line number Diff line change
Expand Up @@ -136,26 +136,22 @@ internal fun Project.configurePublishing(
}
}

plugins.apply("signing")
extensions.getByType(SigningExtension::class.java).apply {
// GPG_PRIVATE_KEY should contain the armoured private key that starts with -----BEGIN PGP PRIVATE KEY BLOCK-----
// It can be obtained with gpg --armour --export-secret-keys KEY_ID
useInMemoryPgpKeys(System.getenv("GPG_KEY"), System.getenv("GPG_KEY_PASSWORD"))
sign(publishing.publications)
if (signingOptions != null) {
plugins.apply("signing")
val signing = extensions.getByType(SigningExtension::class.java)

signing.useInMemoryPgpKeys(
signingOptions.privateKey,
signingOptions.privateKeyPassword
)
signing.sign(publishing.publications)

// See https://github.com/gradle/gradle/issues/26091
tasks.withType(AbstractPublishToMaven::class.java).configureEach {
val signingTasks = tasks.withType(Sign::class.java)
it.mustRunAfter(signingTasks)
}
}

// if (signingOptions != null) {
// val signing = extensions.getByType(SigningExtension::class.java)
//
// signing.useInMemoryPgpKeys(System.getenv("GPG_KEY"), System.getenv("GPG_KEY_PASSWORD"))
// signing.sign(publishing.publications)
//
// // See https://github.com/gradle/gradle/issues/26091
// tasks.withType(AbstractPublishToMaven::class.java).configureEach {
// val signingTasks = tasks.withType(Sign::class.java)
// it.mustRunAfter(signingTasks)
// }
// }
}

/**
Expand Down

0 comments on commit 2259266

Please sign in to comment.