From ccd671004cfa7e4d8641b8e7d444037a8be6d636 Mon Sep 17 00:00:00 2001 From: Mahmoud Ben Hassine Date: Wed, 18 Jan 2023 20:40:31 +0100 Subject: [PATCH] Add github action to stage a release to Sonatype --- .github/workflows/sonatype-staging-build.yml | 79 ++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 .github/workflows/sonatype-staging-build.yml diff --git a/.github/workflows/sonatype-staging-build.yml b/.github/workflows/sonatype-staging-build.yml new file mode 100644 index 000000000..705d9efba --- /dev/null +++ b/.github/workflows/sonatype-staging-build.yml @@ -0,0 +1,79 @@ +name: Sonatype Staging + +on: + workflow_dispatch: + inputs: + releaseVersion: + description: "Release version" + required: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + + - name: Capture release version + run: echo RELEASE_VERSION=${{ github.event.inputs.releaseVersion }} >> $GITHUB_ENV + + - name: Prepare directory structure + run: | + mkdir -p nexus/org/springframework/batch/spring-batch-bom/$RELEASE_VERSION + mkdir -p nexus/org/springframework/batch/spring-batch-infrastructure/$RELEASE_VERSION + mkdir -p nexus/org/springframework/batch/spring-batch-core/$RELEASE_VERSION + mkdir -p nexus/org/springframework/batch/spring-batch-test/$RELEASE_VERSION + mkdir -p nexus/org/springframework/batch/spring-batch-integration/$RELEASE_VERSION + + - name: Download release files from Artifactory + env: + ARTIFACTORY_URL: "https://repo.spring.io/libs-staging-local/org/springframework/batch" + run: | + echo "Downloading BOM artifacts" + cd nexus/org/springframework/batch/spring-batch-bom/$RELEASE_VERSION + wget $ARTIFACTORY_URL/spring-batch-bom/$RELEASE_VERSION/spring-batch-bom-$RELEASE_VERSION.pom + + echo "Downloading infrastructure artifacts" + cd ../../../../../.. + cd nexus/org/springframework/batch/spring-batch-infrastructure/$RELEASE_VERSION + wget $ARTIFACTORY_URL/spring-batch-infrastructure/$RELEASE_VERSION/spring-batch-infrastructure-$RELEASE_VERSION.pom + wget $ARTIFACTORY_URL/spring-batch-infrastructure/$RELEASE_VERSION/spring-batch-infrastructure-$RELEASE_VERSION.jar + wget $ARTIFACTORY_URL/spring-batch-infrastructure/$RELEASE_VERSION/spring-batch-infrastructure-$RELEASE_VERSION-javadoc.pom + wget $ARTIFACTORY_URL/spring-batch-infrastructure/$RELEASE_VERSION/spring-batch-infrastructure-$RELEASE_VERSION-sources.pom + + echo "Downloading core artifacts" + cd ../../../../../.. + wget $ARTIFACTORY_URL/spring-batch-core/$RELEASE_VERSION/spring-batch-core-$RELEASE_VERSION.pom + wget $ARTIFACTORY_URL/spring-batch-core/$RELEASE_VERSION/spring-batch-core-$RELEASE_VERSION.jar + wget $ARTIFACTORY_URL/spring-batch-core/$RELEASE_VERSION/spring-batch-core-$RELEASE_VERSION-javadoc.pom + wget $ARTIFACTORY_URL/spring-batch-core/$RELEASE_VERSION/spring-batch-core-$RELEASE_VERSION-sources.pom + + echo "Downloading test artifacts" + cd ../../../../../.. + wget $ARTIFACTORY_URL/spring-batch-test/$RELEASE_VERSION/spring-batch-test-$RELEASE_VERSION.pom + wget $ARTIFACTORY_URL/spring-batch-test/$RELEASE_VERSION/spring-batch-test-$RELEASE_VERSION.jar + wget $ARTIFACTORY_URL/spring-batch-test/$RELEASE_VERSION/spring-batch-test-$RELEASE_VERSION-javadoc.pom + wget $ARTIFACTORY_URL/spring-batch-test/$RELEASE_VERSION/spring-batch-test-$RELEASE_VERSION-sources.pom + + echo "Downloading integration artifacts" + cd ../../../../../.. + wget $ARTIFACTORY_URL/spring-batch-integration/$RELEASE_VERSION/spring-batch-integration-$RELEASE_VERSION.pom + wget $ARTIFACTORY_URL/spring-batch-integration/$RELEASE_VERSION/spring-batch-integration-$RELEASE_VERSION.jar + wget $ARTIFACTORY_URL/spring-batch-integration/$RELEASE_VERSION/spring-batch-integration-$RELEASE_VERSION-javadoc.pom + wget $ARTIFACTORY_URL/spring-batch-integration/$RELEASE_VERSION/spring-batch-integration-$RELEASE_VERSION-sources.pom + + - name: Sign artifacts and upload them to a Sonatype staging repository + uses: jvalkeal/nexus-sync@v0 + id: nexus + with: + url: ${{ secrets.OSSRH_URL }} + username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }} + password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }} + staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }} + create: true + upload: true + generate-checksums: true + pgp-sign: true + pgp-sign-passphrase: ${{ secrets.GPG_PASSPHRASE }} + pgp-sign-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + + - name: Print staging repository Id + run: echo ${{ steps.nexus.outputs.staged-repository-id }}