From 8cf33fe66403a0e10ff5a00e1cc7e96dfe25c78b Mon Sep 17 00:00:00 2001 From: Ilayaperumal Gopinathan Date: Wed, 29 Jan 2025 18:48:33 +0000 Subject: [PATCH] Cleanup artifactory and maven release actions - Delete the old maven central release workflow and replace it with the new workflow which uses nexus staging plugin - Delete the artifactory staging release workflow as it is no longer needed - This was used to push the artifacts into repo.spring.io libs-staging-local before pushing into sonatype staging. With the nexus staging plugin, we directly push the artifacts into sonatype staging - Delete maven central staging release workflow as it is no longer needed as well --- .github/workflows/artifactory-staging.yml | 38 --------- .github/workflows/maven-central-release.yml | 94 ++++++++------------- .github/workflows/maven-central-stage.yml | 58 ------------- 3 files changed, 33 insertions(+), 157 deletions(-) delete mode 100644 .github/workflows/artifactory-staging.yml delete mode 100644 .github/workflows/maven-central-stage.yml diff --git a/.github/workflows/artifactory-staging.yml b/.github/workflows/artifactory-staging.yml deleted file mode 100644 index 3f0303d04..000000000 --- a/.github/workflows/artifactory-staging.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Artifactory Staging - -on: - workflow_dispatch: - inputs: - releaseVersion: - description: "Release version" - required: true - -jobs: - build: - name: Stage release to Artifactory - runs-on: ubuntu-latest - steps: - - name: Checkout source code - uses: actions/checkout@v4 - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - cache: 'maven' - - - name: Capture release version - run: echo RELEASE_VERSION=${{ github.event.inputs.releaseVersion }} >> $GITHUB_ENV - - - name: Update release version - run: mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$RELEASE_VERSION - - - name: Enforce release rules - run: mvn org.apache.maven.plugins:maven-enforcer-plugin:enforce -Drules=requireReleaseDeps - - - name: Build with Maven and deploy to Artifactory staging repository - env: - ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} - ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} - run: mvn -P artifactory-staging -s settings.xml --batch-mode -Dmaven.test.skip=true deploy diff --git a/.github/workflows/maven-central-release.yml b/.github/workflows/maven-central-release.yml index df3b55871..86ee9642b 100644 --- a/.github/workflows/maven-central-release.yml +++ b/.github/workflows/maven-central-release.yml @@ -1,4 +1,4 @@ -name: Maven Central Release +name: Release to Maven Central on: workflow_dispatch: @@ -9,68 +9,40 @@ on: jobs: build: + name: Release project runs-on: ubuntu-latest + steps: - - name: Capture release version - run: echo RELEASE_VERSION=${{ github.event.inputs.releaseVersion }} >> $GITHUB_ENV + - name: Check out sources + uses: actions/checkout@v4 - - name: Prepare directory structure - run: | - mkdir -p nexus/org/springframework/ai/spring-ai-core/$RELEASE_VERSION - mkdir -p nexus/org/springframework/ai/spring-ai-openai/$RELEASE_VERSION - mkdir -p nexus/org/springframework/ai/spring-ai-azure-openai/$RELEASE_VERSION - mkdir -p nexus/org/springframework/ai/spring-ai-spring-boot-autoconfigure/$RELEASE_VERSION - - - name: Download release files from Artifactory - env: - ARTIFACTORY_URL: "https://repo.spring.io/libs-staging-local/org/springframework/ai" - run: | - echo "Downloading core artifacts" - cd ../../../../../.. - cd nexus/org/springframework/ai/spring-ai-core/$RELEASE_VERSION - wget $ARTIFACTORY_URL/spring-ai-core/$RELEASE_VERSION/spring-ai-core-$RELEASE_VERSION.pom - wget $ARTIFACTORY_URL/spring-ai-core/$RELEASE_VERSION/spring-ai-core-$RELEASE_VERSION.jar - wget $ARTIFACTORY_URL/spring-ai-core/$RELEASE_VERSION/spring-ai-core-$RELEASE_VERSION-javadoc.jar - wget $ARTIFACTORY_URL/spring-ai-core/$RELEASE_VERSION/spring-ai-core-$RELEASE_VERSION-sources.jar - - echo "Downloading openai artifacts" - cd ../../../../../.. - cd nexus/org/springframework/batch/spring-ai-openai/$RELEASE_VERSION - wget $ARTIFACTORY_URL/spring-ai-openai/$RELEASE_VERSION/spring-ai-openai-$RELEASE_VERSION.pom - wget $ARTIFACTORY_URL/spring-ai-openai/$RELEASE_VERSION/spring-ai-openai-$RELEASE_VERSION.jar - wget $ARTIFACTORY_URL/spring-ai-openai/$RELEASE_VERSION/spring-ai-openai-$RELEASE_VERSION-javadoc.jar - wget $ARTIFACTORY_URL/spring-ai-openai/$RELEASE_VERSION/spring-ai-openai-$RELEASE_VERSION-sources.jar - - echo "Downloading azure openai artifacts" - cd ../../../../../.. - cd nexus/org/springframework/batch/spring-ai-azure-openai/$RELEASE_VERSION - wget $ARTIFACTORY_URL/spring-ai-azure-openai/$RELEASE_VERSION/spring-ai-azure-openai-$RELEASE_VERSION.pom - wget $ARTIFACTORY_URL/spring-ai-azure-openai/$RELEASE_VERSION/spring-ai-azure-openai-$RELEASE_VERSION.jar - wget $ARTIFACTORY_URL/spring-ai-azure-openai/$RELEASE_VERSION/spring-ai-azure-openai-$RELEASE_VERSION-javadoc.jar - wget $ARTIFACTORY_URL/spring-ai-azure-openai/$RELEASE_VERSION/spring-ai-azure-openai-$RELEASE_VERSION-sources.jar - - echo "Downloading autoconfiguration artifacts" - cd ../../../../../.. - cd nexus/org/springframework/batch/spring-ai-spring-boot-autoconfigure/$RELEASE_VERSION - wget $ARTIFACTORY_URL/spring-ai-spring-boot-autoconfigure/$RELEASE_VERSION/spring-ai-spring-boot-autoconfigure-$RELEASE_VERSION.pom - wget $ARTIFACTORY_URL/spring-ai-spring-boot-autoconfigure/$RELEASE_VERSION/spring-ai-spring-boot-autoconfigure-$RELEASE_VERSION.jar - wget $ARTIFACTORY_URL/spring-ai-spring-boot-autoconfigure/$RELEASE_VERSION/spring-ai-spring-boot-autoconfigure-$RELEASE_VERSION-javadoc.jar - wget $ARTIFACTORY_URL/spring-ai-spring-boot-autoconfigure/$RELEASE_VERSION/spring-ai-spring-boot-autoconfigure-$RELEASE_VERSION-sources.jar - - - name: Sign artifacts and release them to Maven Central - uses: jvalkeal/nexus-sync@v0 - id: nexus + - name: Set up JDK 17 + uses: actions/setup-java@v3 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 - close: true - release: true - generate-checksums: true - pgp-sign: true - pgp-sign-passphrase: ${{ secrets.GPG_PASSPHRASE }} - pgp-sign-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + distribution: 'temurin' + java-version: 17 + cache: 'maven' + + - name: Install GPG key + run: | + echo "${{ secrets.GPG_PRIVATE_KEY }}" > gpg.asc + echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --passphrase-fd 0 --import gpg.asc + + - name: Release to Sonatype OSSRH + env: + SONATYPE_USER: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + run: | + ./mvnw -B clean install -DskipTests + ./mvnw -B clean deploy -Psonatype -s settings.xml + + - name: Setup Graphviz + uses: ts-graphviz/setup-graphviz@v1 + + - name: Deploy documentation + env: + ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} + ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} + run: ./mvnw -B clean deploy -Pdocumentation \ No newline at end of file diff --git a/.github/workflows/maven-central-stage.yml b/.github/workflows/maven-central-stage.yml deleted file mode 100644 index 8b5c7f7ef..000000000 --- a/.github/workflows/maven-central-stage.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Maven Central Staging - -on: - workflow_dispatch: - inputs: - buildName: - description: "Artifactory build name" - required: true - buildNumber: - description: "Artifactory build number" - required: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - # to get spec file in .github - - uses: actions/checkout@v4 - - # Setup jfrog cli - - uses: jfrog/setup-jfrog-cli@v1 - with: - version: 1.43.2 - env: - JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} - - # Extract build id from input - - name: Extract Build Id - run: | - echo JFROG_CLI_BUILD_NAME=${{ github.event.inputs.buildName }} >> $GITHUB_ENV - echo JFROG_CLI_BUILD_NUMBER=${{ github.event.inputs.buildNumber }} >> $GITHUB_ENV - - # Download released files - - name: Download Release Files - run: | - jfrog rt download \ - --spec .github/release-files-spec.json \ - --spec-vars "buildname=$JFROG_CLI_BUILD_NAME;buildnumber=$JFROG_CLI_BUILD_NUMBER" - - # Create checksums, signatures and create staging repo on central and upload - - 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 }} - - # Print staging repo id - - name: Print Staging Repo Id - run: echo ${{ steps.nexus.outputs.staged-repository-id }}