diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1be6b85..cccfff0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -222,6 +222,14 @@ jobs: java-version: 11 cache: 'gradle' + - name: Import GPG key + id: import_gpg + uses: crazy-max/ghaction-import-gpg@v5 + with: + git_user_signingkey: true + gpg_private_key: ${{ secrets.OSS_GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.OSS_GPG_PASSPHARSE }} + - name: Publish GitHub Package if: env.ENABLE_GH_MAVEN == 'true' run: | diff --git a/build.gradle.kts b/build.gradle.kts index 42acb19..614cb9e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -165,25 +165,30 @@ publishing { fromResolutionResult() } } - pom { - name.set(prop(project, "title")) - description.set(prop(project, "description")) - url.set("https://github.com/play-iot/gradle-plugin") - licenses { - license { - name.set("The Apache License, Version 2.0") - url.set("https://github.com/play-iot/gradle-plugin/blob/main/LICENSE") + } + + afterEvaluate { + withType { + pom { + name.set(prop(project, "title")) + description.set(prop(project, "description")) + url.set("https://github.com/play-iot/gradle-plugin") + licenses { + license { + name.set("The Apache License, Version 2.0") + url.set("https://github.com/play-iot/gradle-plugin/blob/main/LICENSE") + } } - } - developers { - developer { - id.set("zero88") - email.set("sontt246@gmail.com") + developers { + developer { + id.set("zero88") + email.set("sontt246@gmail.com") + } + } + scm { + connection.set("scm:git:git://git@github.com:play-iot/gradle-plugin.git") + url.set("https://github.com/play-iot/gradle-plugin") } - } - scm { - connection.set("scm:git:git://git@github.com:play-iot/gradle-plugin.git") - url.set("https://github.com/play-iot/gradle-plugin") } } } @@ -218,19 +223,10 @@ nexusPublishing { packageGroup.set("cloud.playio") repositories { sonatype { - val (releaseUrl, snapshotUrl) = getRepositoryUrl() - nexusUrl.set(uri(releaseUrl)) - snapshotRepositoryUrl.set(uri(snapshotUrl)) + nexusUrl.set(uri(prop(project, "ossrh.release.url"))) + snapshotRepositoryUrl.set(uri(prop(project, "ossrh.snapshot.url"))) username.set(project.property("nexus.username") as String?) password.set(project.property("nexus.password") as String?) } } } - -fun getRepositoryUrl(): Pair { - if (project.hasProperty("github")) { - val path = "${project.property("github.nexus.url")}/${project.property("nexus.username")}/${rootProject.name}" - return Pair(path, path) - } - return Pair(prop(project, "ossrh.release.url"), prop(project, "ossrh.snapshot.url")) -}