1+ name : Build with Gradle and Stage Release to Artifactory
2+
3+ on :
4+ workflow_call :
5+ inputs :
6+ releaseVersion :
7+ description : ' Release version like 3.0.0-M1, 3.1.0-RC1, 3.2.0 etc'
8+ required : true
9+ type : string
10+ nextDevelopmentVersion :
11+ description : ' Next development version like 3.1.1-SNAPSHOT'
12+ required : true
13+ type : string
14+ gradleTasks :
15+ description : ' Additional Gradle tasks. The `build` and `artifactoryPublish` are included.'
16+ required : false
17+ default : ' dist'
18+ type : string
19+
20+ run-name : Release version ${{ inputs.releaseVersion }}
21+
22+ env :
23+ GRADLE_ENTERPRISE_CACHE_USERNAME : ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
24+ GRADLE_ENTERPRISE_CACHE_PASSWORD : ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
25+ GRADLE_ENTERPRISE_ACCESS_KEY : ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
26+
27+ jobs :
28+ staging :
29+ runs-on : ubuntu-latest
30+ if : github.repository_owner == 'spring-projects'
31+ steps :
32+
33+ - uses : actions/checkout@v3
34+ with :
35+ token : ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
36+
37+ - name : Set up Gradle
38+ uses : spring-io/spring-gradle-build-action@v2
39+
40+ - uses : jfrog/setup-jfrog-cli@v3
41+ with :
42+ version : 2.50.4
43+ env :
44+ JF_ENV_SPRING : ${{ secrets.JF_ARTIFACTORY_SPRING }}
45+
46+ - name : Configure JFrog Cli
47+ run : |
48+ jf gradlec \
49+ --use-wrapper \
50+ --uses-plugin \
51+ --deploy-ivy-desc=false \
52+ --server-id-resolve repo.spring.io \
53+ --server-id-deploy repo.spring.io \
54+ --repo-resolve ${{ (contains(inputs.releaseVersion, 'M') || contains(inputs.releaseVersion, 'RC')) && 'milestone' || 'release' }} \
55+ --repo-deploy libs-staging-local
56+ echo JFROG_CLI_BUILD_NAME=${{ github.event.repository.name }}-${{ inputs.releaseVersion }} >> $GITHUB_ENV
57+ echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV
58+
59+ - name : Set Release Version
60+ run : |
61+ sed -i "s/version=.*/version=${{ inputs.releaseVersion }}/" gradle.properties
62+
63+ - name : Build and Publish
64+ run : |
65+ jf gradle build ${{ inputs.gradleTasks }} artifactoryPublish
66+ jf rt build-publish
67+
68+ - name : Tag Release and Next Development Version
69+ run : |
70+ git config --global user.name 'Spring Builds'
71+ git config --global user.email 'builds@springframework.org'
72+ git commit -a -m "[artifactory-release] Release version ${{ inputs.releaseVersion }}"
73+ git tag "v${{ inputs.releaseVersion }}"
74+ git push --tags origin
75+ sed -i "s/version=.*/version=${{ inputs.nextDevelopmentVersion }}/" gradle.properties
76+ git commit -a -m "[artifactory-release] Next development version"
77+ git push origin
78+
79+ - name : Print Build Info
80+ run : |
81+ echo "::notice ::Artifactory Build Name=$JFROG_CLI_BUILD_NAME"
82+ echo "::notice ::Artifactory Build Number=$JFROG_CLI_BUILD_NUMBER"
0 commit comments