diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index f9477e7..708318d 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -1,7 +1,7 @@ # This workflow will build a Java project with Gradle # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle -name: Java CI with Gradle +name: Java CI/CD with Gradle on: push: @@ -15,13 +15,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up JDK 1.8 - uses: actions/setup-java@v3 - with: - java-version: '8' - distribution: 'temurin' - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew build + - uses: actions/checkout@v3 + - name: Set up JDK 1.8 + uses: actions/setup-java@v3 + with: + java-version: '8' + distribution: 'temurin' + cache: gradle + - name: Build with Gradle + run: ./gradlew build --no-daemon + diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ed0c7ba..4a85394 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,5 +1,6 @@ name: Publish package to the Maven Central Repository on: + workflow_dispatch: release: types: [ created ] jobs: @@ -19,4 +20,4 @@ jobs: ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }} ORG_GRADLE_PROJECT_signingKey: ${{ secrets.OSSRH_GPG_SECRET_KEY }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.OSSRH_GPG_SECRET_PASSPHRASE }} - run: ./gradlew publishToSonatype --no-daemon \ No newline at end of file + run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository --no-daemon \ No newline at end of file diff --git a/build.gradle b/build.gradle index 80f0c8c..16171fa 100644 --- a/build.gradle +++ b/build.gradle @@ -84,17 +84,14 @@ nexusPublishing { sonatype { nexusUrl = uri("https://oss.sonatype.org/service/local/") snapshotRepositoryUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/") - username = project.hasProperty('sonaAccessUser') ? project.property('sonaAccessUser') : "" - password = project.hasProperty('sonaAccessToken') ? project.property('sonaAccessToken') : "" } } } -ext["signing.keyId"] = project.hasProperty("signing.keyId") ? project.property("signing.keyId") : "" -ext["signing.password"] = project.hasProperty("signing.password") ? project.property("signing.password") : "" -ext["signing.secretKeyRingFile"] = project.hasProperty("signing.secretKeyRingFile") ? project.property("signing.secretKeyRingFile") : "" - signing { + def signingKey = findProperty("signingKey") + def signingPassword = findProperty("signingPassword") + useInMemoryPgpKeys(signingKey, signingPassword) sign publishing.publications }