Skip to content

Commit

Permalink
fix(buildSrc): fix publishing script
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultBee committed Jul 15, 2024
1 parent 09d1326 commit d06424c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@ jobs:
git config --global user.email "<>"
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Decode the secret key
run: echo $GPG_KEYRING_FILE_CONTENT | base64 --decode > ~/secring.gpg
env:
GPG_KEYRING_FILE_CONTENT: "${{ secrets.GPG_KEYRING_FILE_CONTENT }}"
- name: Publish package
run: ./gradlew publish -Psigning.secretKeyRingFile=$(echo ~/secring.gpg) -Psigning.password=$GPG_PASSPHRASE -Psigning.keyId=$GPG_KEY_ID
run: ./gradlew publish
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
GPG_KEY: ${{ secrets.GPG_KEY }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Property.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
enum class Property(val key: String) {
SonatypeUsername("NEXUS_USERNAME"),
SonatypePassword("NEXUS_PASSWORD"),
SonatypeUsername("MAVEN_USERNAME"),
SonatypePassword("MAVEN_PASSWORD"),
GpgKey("GPG_KEY"),
GpgKeyId("GPG_KEY_ID"),
GpgPassword("GPG_PASSWORD");
Expand Down
15 changes: 10 additions & 5 deletions buildSrc/src/main/kotlin/Publication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ fun Project.configurePublication() {
repositories {
maven {
if (isRelease) {
setUrl("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
setUrl("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
} else {
println("Using SNAPSHOT repository")
setUrl("https://oss.sonatype.org/content/repositories/snapshots/")
setUrl("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}

credentials {
Expand All @@ -49,10 +49,15 @@ fun Project.configurePublication() {
apply(plugin = "signing")

the<SigningExtension>().apply {
val keyId =
Publication.Signing.keyId ?: throw IllegalStateException("No signing key ID found")
val key = Publication.Signing.key ?: throw IllegalStateException("No signing key found")
val password = Publication.Signing.password
?: throw IllegalStateException("No signing key password found")
useInMemoryPgpKeys(
Publication.Signing.keyId,
Publication.Signing.key,
Publication.Signing.password
keyId,
key,
password
)
sign(the<PublishingExtension>().publications)
}
Expand Down

0 comments on commit d06424c

Please sign in to comment.