diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 292aed20..981848bf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,6 +19,14 @@ jobs: - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@v1 + # Retrieve the version of the SDK + - name: Install dasel + run: curl -sSLf "$(curl -sSLf https://api.github.com/repos/tomwright/dasel/releases/latest | grep browser_download_url | grep linux_amd64 | grep -v .gz | cut -d\" -f 4)" -L -o dasel && chmod +x dasel && mv ./dasel /usr/local/bin/dasel + - name: Bump version overwriting libs.versions.toml + run: | + echo "PUBLISHED_SDK_VERSION=$(dasel -f gradle/libs.versions.toml '.versions.restate')" >> "$GITHUB_ENV" + + # Dry run - name: Publish dry-run uses: gradle/gradle-build-action@v2 env: @@ -28,7 +36,7 @@ jobs: with: arguments: publishToMavenLocal - - name: Publish to Maven Central + - name: Publish to staging area on Maven Central uses: gradle/gradle-build-action@v2 env: MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} @@ -37,3 +45,14 @@ jobs: MAVEN_CENTRAL_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }} with: arguments: publish + + - name: Release staging area + if: !contains(env.PUBLISHED_SDK_VERSION, '-SNAPSHOT') + uses: gradle/gradle-build-action@v2 + env: + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} + MAVEN_CENTRAL_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_CENTRAL_GPG_PRIVATE_KEY }} + MAVEN_CENTRAL_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }} + with: + arguments: findSonatypeStagingRepository closeAndReleaseSonatypeStagingRepository diff --git a/buildSrc/src/main/kotlin/library-publishing-conventions.gradle.kts b/buildSrc/src/main/kotlin/library-publishing-conventions.gradle.kts index 5e6a2dd1..d39110c9 100644 --- a/buildSrc/src/main/kotlin/library-publishing-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/library-publishing-conventions.gradle.kts @@ -30,6 +30,14 @@ project.afterEvaluate { developerConnection = "scm:git:ssh://github.com/restatedev/sdk-java.git" url = "https://github.com/restatedev/sdk-java" } + + developers { + developer { + name = "Francesco Guardiani" + id = "slinkydeveloper" + email = "francescoguard@gmail.com" + } + } } } } @@ -43,6 +51,6 @@ project.afterEvaluate { val publishing: PublishingExtension by project useInMemoryPgpKeys(key, password) - sign(publishing.publications) + sign(publishing.publications["maven"]) } } \ No newline at end of file