Sonatype Deployment #491
This file contains hidden or 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: Sonatype Deployment | |
| on: | |
| pull_request: | |
| branches: ["main", "release/*"] | |
| workflow_dispatch: | |
| jobs: | |
| publish_release: | |
| name: Publish artifacts | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup JDK 11 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '11' | |
| distribution: 'temurin' | |
| cache: 'gradle' | |
| - name: Publish to sonatype and close the staging repo | |
| env: | |
| ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} | |
| ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} | |
| ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} | |
| run: ./gradlew clean publishToSonatype closeSonatypeStagingRepository --max-workers 1 | |
| # - name: Upload staged artifacts to Central Sonatype | |
| # env: | |
| # SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
| # SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
| # run: | | |
| # # token is a b64-encoded string of username:password, used in auth header of API call | |
| # SONATYPE_TOKEN=$(printf "$SONATYPE_USERNAME:$SONATYPE_PASSWORD" | base64) | |
| # PUBLISH_NAMESPACE="io.github.ywang-nr" | |
| # # makes a curl request to ossrh-staging-api to upload everything to Central Sonatype | |
| # echo "Uploading artifacts from OSSRH-Staging to Central Sonatype..." | |
| # # captures response code and body of curl request | |
| # RESPONSE=$(curl -s -w "%{http_code}" -o response_body.txt -X POST \ | |
| # -H "Authorization: Bearer $SONATYPE_TOKEN" \ | |
| # "https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/$PUBLISH_NAMESPACE?publishing_type=user_managed") | |
| # # job fails if we got anything back but a 200 | |
| # if [ "$RESPONSE" -ne 200 ]; then | |
| # echo "Failed to upload artifacts to Central Sonatype. Response code: $RESPONSE. Response body: " | |
| # cat response_body.txt | |
| # echo "Visit https://central.sonatype.com/publishing/deployments for more information." | |
| # exit 1 | |
| # else | |
| # echo "Artifacts were uploaded successfully to Central Sonatype." | |
| # echo "Visit https://central.sonatype.com/publishing/deployments to view your artifacts." | |
| # fi | |
| # publish_mono_release: | |
| # name: Publish Mono artifacts | |
| # runs-on: ubuntu-latest | |
| # steps: | |
| # - uses: actions/checkout@v3 | |
| # - name: Setup JDK 11 | |
| # uses: actions/setup-java@v3 | |
| # with: | |
| # java-version: '11' | |
| # distribution: 'temurin' | |
| # cache: 'gradle' | |
| # - name: Publish to sonatype and close the staging repo | |
| # env: | |
| # ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} | |
| # ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} | |
| # ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }} | |
| # ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} | |
| # ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} | |
| # run: ./gradlew clean publishToSonatype closeSonatypeStagingRepository --max-workers 1 -PmonoEnabled=true | |