diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fbe6a7b..ed53e8b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: master fetch-depth: 0 @@ -17,7 +17,7 @@ jobs: git config user.name "Zonky Bot" git config user.email "bot@zonky.com" - name: Set up JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: 8 @@ -48,4 +48,24 @@ jobs: -Prelease.useAutomaticVersion=true \ -Prelease.releaseVersion=$RELEASE_VERSION \ -Possrh.username=$MAVEN_USER \ - -Possrh.password=$MAVEN_PASS \ No newline at end of file + -Possrh.password=$MAVEN_PASS + - name: Upload staged artifacts to Central Sonatype + env: + SONATYPE_USERNAME: ${{ secrets.MAVEN_USER }} + SONATYPE_PASSWORD: ${{ secrets.MAVEN_PASS }} + run: | + SONATYPE_TOKEN=$(printf "$SONATYPE_USERNAME:$SONATYPE_PASSWORD" | base64) + PUBLISH_NAMESPACE="io.zonky" + echo "Uploading artifacts from OSSRH-Staging to Central Sonatype..." + 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") + 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 \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c19d217..c9c0f96 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,9 +10,9 @@ jobs: java: [8, 11, 17] steps: - name: Checkout project - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'zulu' java-version: ${{ matrix.java }} diff --git a/build.gradle b/build.gradle index 49d65d0..31249fd 100644 --- a/build.gradle +++ b/build.gradle @@ -208,8 +208,8 @@ subprojects { repositories { maven { - def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" - def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/" + def releasesRepoUrl = "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/" + def snapshotsRepoUrl = "https://central.sonatype.com/repository/maven-snapshots/" url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl credentials { username ossrhUsername