From d06424c37cb1c0d62f3e2cd652753055a4ca5eb4 Mon Sep 17 00:00:00 2001 From: ThibaultBee <37510686+ThibaultBee@users.noreply.github.com> Date: Mon, 15 Jul 2024 13:25:09 +0200 Subject: [PATCH] fix(buildSrc): fix publishing script --- .github/workflows/release.yml | 7 ++----- buildSrc/src/main/kotlin/Property.kt | 4 ++-- buildSrc/src/main/kotlin/Publication.kt | 15 ++++++++++----- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4a646f20..36a6ac04 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Property.kt b/buildSrc/src/main/kotlin/Property.kt index ab2bfe47..7c0eae10 100644 --- a/buildSrc/src/main/kotlin/Property.kt +++ b/buildSrc/src/main/kotlin/Property.kt @@ -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"); diff --git a/buildSrc/src/main/kotlin/Publication.kt b/buildSrc/src/main/kotlin/Publication.kt index edc3c32f..017c4783 100644 --- a/buildSrc/src/main/kotlin/Publication.kt +++ b/buildSrc/src/main/kotlin/Publication.kt @@ -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 { @@ -49,10 +49,15 @@ fun Project.configurePublication() { apply(plugin = "signing") the().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().publications) }