From 53c4399f28553d96bd54a821292a84b12d631328 Mon Sep 17 00:00:00 2001 From: Mahmoud Ben Hassine Date: Wed, 6 Dec 2023 10:20:32 +0100 Subject: [PATCH] Use JFrog Cli to upload files to Artifactory --- .github/release-files-spec.json | 2 +- .../workflows/continuous-integration-43x.yml | 23 +++++++++++++++---- build.gradle | 22 ------------------ 3 files changed, 19 insertions(+), 28 deletions(-) diff --git a/.github/release-files-spec.json b/.github/release-files-spec.json index 66e9c681b5..222aed3678 100644 --- a/.github/release-files-spec.json +++ b/.github/release-files-spec.json @@ -7,7 +7,7 @@ { "@build.name": "${buildname}", "@build.number": "${buildnumber}", - "path": {"$match": "org*"} + "path": {"$match": "org/springframework/batch*"} }, { "$or": [ diff --git a/.github/workflows/continuous-integration-43x.yml b/.github/workflows/continuous-integration-43x.yml index bb5df0a8fd..529e35650f 100644 --- a/.github/workflows/continuous-integration-43x.yml +++ b/.github/workflows/continuous-integration-43x.yml @@ -23,10 +23,23 @@ jobs: java-version: '8' distribution: 'adopt' - - name: Build the project and deploy to Artifactory - env: - ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} - ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} + - name: Build the project run: | ./gradlew clean build install --parallel --stacktrace --info - ./gradlew artifactoryPublish + + - name: Setup JFrog Cli + uses: jfrog/setup-jfrog-cli@901bb9632db90821c2d3f076012bdeaf66598555 # v3.4.1 + env: + JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} + + - name: Configure JFrog Cli + run: | + jf gradlec --use-wrapper --repo-deploy libs-snapshot-local + echo JFROG_CLI_BUILD_NAME=${{ github.event.repository.name }}-${{ github.ref_name }} >> $GITHUB_ENV + echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV + + - name: Deploy to Artifactory + run: | + jf rt upload \ + --spec .github/release-files-spec.json \ + --spec-vars "buildname=$JFROG_CLI_BUILD_NAME;buildnumber=$JFROG_CLI_BUILD_NUMBER" diff --git a/build.gradle b/build.gradle index ef919474f5..ba978abd94 100644 --- a/build.gradle +++ b/build.gradle @@ -21,26 +21,8 @@ plugins { id 'org.asciidoctor.jvm.pdf' version '3.1.0' id 'org.asciidoctor.jvm.gems' version '3.1.0' id 'org.asciidoctor.jvm.convert' version '3.1.0' - id 'com.jfrog.artifactory' version '5.1.11' } -artifactory { - publish { - contextUrl = 'https://repo.spring.io' - repository { - repoKey = 'libs-snapshot-local' - username = "${System.env.ARTIFACTORY_USERNAME}" - password = "${System.env.ARTIFACTORY_PASSWORD}" - } - - defaults { - publications('ALL_PUBLICATIONS') - } - } -} - -artifactoryPublish.skip = true - ext { linkHomepage = 'https://projects.spring.io/spring-batch/' linkCi = 'https://build.spring.io/browse/BATCH' @@ -428,13 +410,11 @@ project('spring-batch-infrastructure') { project('spring-batch-docs') { description = 'Spring Batch Docs' project.tasks.findByPath("artifactoryPublish")?.enabled = false - artifactoryPublish.skip = true } project('spring-batch-core-tests') { description = 'Spring Batch Core Tests' project.tasks.findByPath("artifactoryPublish")?.enabled = false - artifactoryPublish.skip = true dependencies { compile project(":spring-batch-core") compile project(":spring-batch-infrastructure") @@ -474,7 +454,6 @@ project('spring-batch-core-tests') { project('spring-batch-infrastructure-tests') { description = 'Spring Batch Infrastructure Tests' project.tasks.findByPath("artifactoryPublish")?.enabled = false - artifactoryPublish.skip = true dependencies { compile project(":spring-batch-infrastructure") compile "javax.jms:javax.jms-api:$jmsVersion" @@ -605,7 +584,6 @@ project('spring-batch-integration') { project('spring-batch-samples') { description = 'Batch Batch Samples' project.tasks.findByPath("artifactoryPublish")?.enabled = false - artifactoryPublish.skip = true dependencies {