Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish release | ||
on: | ||
workflow_call: | ||
jobs: | ||
publish: | ||
if: github.repository == 'restatedev/sdk-java' | ||
name: Publish | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK ${{ matrix.java }} | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 11 | ||
distribution: 'adopt' | ||
- 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: Parse published sdk version | ||
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: | ||
# Used for checking the signing | ||
MAVEN_CENTRAL_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_CENTRAL_GPG_PRIVATE_KEY }} | ||
MAVEN_CENTRAL_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_GPG_PASSPHRASE }} | ||
with: | ||
arguments: publishToMavenLocal | ||
- name: Publish to staging area on Maven Central | ||
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: publishToSonatype | ||
- name: Release staging area | ||
uses: gradle/gradle-build-action@v2 | ||
if: !contains(env.PUBLISHED_SDK_VERSION, '-SNAPSHOT') | ||
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 |