Skip to content
This repository was archived by the owner on Nov 10, 2025. It is now read-only.

Commit 85daa20

Browse files
committed
Add Maven staging support
* Make staging jobs conditional on project type: Maven or Gradle
1 parent 7b1643a commit 85daa20

File tree

6 files changed

+173
-28
lines changed

6 files changed

+173
-28
lines changed

.github/workflows/spring-artifactory-gradle-release-staging.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ jobs:
6666
--use-wrapper \
6767
--repo-deploy libs-staging-local
6868
69-
echo JFROG_CLI_BUILD_NAME=${{ github.event.repository.name }}-${{ inputs.releaseVersion }} >> $GITHUB_ENV
69+
buildName=${{ github.event.repository.name }}-${{ inputs.releaseVersion }}
70+
echo JFROG_CLI_BUILD_NAME=$buildName >> $GITHUB_ENV
7071
echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV
71-
echo buildName=$JFROG_CLI_BUILD_NAME >> $GITHUB_OUTPUT
72+
echo buildName=$buildName >> $GITHUB_OUTPUT
7273
echo buildNumber=$JFROG_CLI_BUILD_NUMBER >> $GITHUB_OUTPUT
7374
7475
- name: Set Release Version
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Build with Maven 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+
mavenArgs:
11+
description: 'Additional mvn command arguments: goals, plugins etc. The `install` is included.'
12+
required: false
13+
type: string
14+
15+
outputs:
16+
buildName:
17+
description: 'Artifactory Build Name'
18+
value: ${{ jobs.staging-to-artifactory-with-maven.outputs.buildName }}
19+
buildNumber:
20+
description: 'Artifactory Build Number'
21+
value: ${{ jobs.staging-to-artifactory-with-maven.outputs.buildNumber }}
22+
23+
jobs:
24+
staging-to-artifactory-with-maven:
25+
runs-on: ubuntu-latest
26+
outputs:
27+
buildName: ${{ steps.configure-jfrog.outputs.buildName }}
28+
buildNumber: ${{ steps.configure-jfrog.outputs.buildNumber }}
29+
steps:
30+
31+
- uses: actions/checkout@v3
32+
with:
33+
token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
34+
35+
- name: Set up JDK
36+
uses: actions/setup-java@v3
37+
with:
38+
distribution: adopt
39+
java-version: 17
40+
cache: 'maven'
41+
42+
- uses: jfrog/setup-jfrog-cli@v3
43+
with:
44+
version: 2.50.4
45+
env:
46+
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
47+
48+
- name: Configure JFrog Cli
49+
id: configure-jfrog
50+
run: |
51+
jf mvnc \
52+
--use-wrapper=true \
53+
--repo-resolve-releases=libs-milestone \
54+
--repo-resolve-snapshots=snapshot \
55+
--repo-deploy-releases=libs-staging-local \
56+
--repo-deploy-snapshots=libs-snapshot-local
57+
58+
buildName=${{ github.event.repository.name }}-${{ inputs.releaseVersion }}
59+
echo JFROG_CLI_BUILD_NAME=$buildName >> $GITHUB_ENV
60+
echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV
61+
echo buildName=$buildName >> $GITHUB_OUTPUT
62+
echo buildNumber=$JFROG_CLI_BUILD_NUMBER >> $GITHUB_OUTPUT
63+
64+
- name: Set Release Version
65+
run: |
66+
./mvnw versions:set -DnewVersion=${{ inputs.releaseVersion }} -DgenerateBackupPoms=false -DprocessAllModules=true -B -ntp
67+
68+
- name: Build and Publish
69+
run: |
70+
jf mvn install -B -ntp ${{ inputs.mavenArgs }}
71+
jf rt build-publish
72+
73+
- name: Capture Test Results
74+
if: failure()
75+
uses: actions/upload-artifact@v3
76+
with:
77+
name: test-results
78+
path: '**/target/surefire-reports/**/*.*'
79+
retention-days: 3
80+
81+
- name: Tag Release and Next Development Version
82+
run: |
83+
git config --global user.name 'Spring Builds'
84+
git config --global user.email 'builds@springframework.org'
85+
git commit -a -m "[artifactory-release] Release version ${{ inputs.releaseVersion }}"
86+
git tag "v${{ inputs.releaseVersion }}"
87+
git push --tags origin
88+
./mvnw build-helper:parse-version versions:set \
89+
-DnewVersion='${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${{ (contains(inputs.releaseVersion, '-M') || contains(inputs.releaseVersion, '-RC')) && '${parsedVersion.incrementalVersion}' || '${parsedVersion.nextIncrementalVersion}' }}'-SNAPSHOT \
90+
-DgenerateBackupPoms=false -DprocessAllModules=true -B -ntp
91+
git commit -a -m "[artifactory-release] Next development version"
92+
git push origin

.github/workflows/spring-artifactory-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ run-name: Release version ${{ inputs.releaseVersion }}
1616

1717
jobs:
1818
staging:
19-
uses: ./.github/workflows/stage-release.yml
19+
uses: spring-projects/spring-integration-aws/.github/workflows/spring-stage-release.yml@main
2020
with:
2121
releaseVersion: ${{ inputs.releaseVersion }}
2222
secrets: inherit
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Stage Release with Gradle or Maven 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+
11+
outputs:
12+
buildName:
13+
description: 'Artifactory Build Name'
14+
value: ${{ jobs.staging-with-gradle.outputs.buildName }}
15+
buildNumber:
16+
description: 'Artifactory Build Number'
17+
value: ${{ jobs.staging-with-gradle.outputs.buildNumber }}
18+
19+
20+
jobs:
21+
maven-or-gradle:
22+
runs-on: ubuntu-latest
23+
outputs:
24+
isMaven: ${{ steps.is-maven.outputs.isMaven }}
25+
steps:
26+
27+
- uses: actions/checkout@v4
28+
with:
29+
show-progress: false
30+
31+
- name: Check if project is Maven-based
32+
id: is-maven
33+
run: |
34+
if test -f pom.xml
35+
then
36+
echo isMaven=true >> $GITHUB_OUTPUT
37+
else
38+
echo isMaven=false >> $GITHUB_OUTPUT
39+
fi
40+
41+
staging-with-gradle:
42+
needs: maven-or-gradle
43+
if: ${{ ! needs.maven-or-gradle.outputs.isMaven }}
44+
uses: spring-projects/spring-integration-aws/.github/workflows/spring-artifactory-gradle-release-staging.yml@main
45+
with:
46+
releaseVersion: ${{ inputs.releaseVersion }}
47+
secrets: inherit
48+
49+
50+
staging-with-maven:
51+
needs: maven-or-gradle
52+
if: ${{ needs.maven-or-gradle.outputs.isMaven }}
53+
uses: spring-projects/spring-integration-aws/.github/workflows/spring-artifactory-maven-release-staging.yml@main
54+
with:
55+
releaseVersion: ${{ inputs.releaseVersion }}
56+
secrets: inherit
57+
58+
build-info:
59+
needs: [staging-with-gradle, staging-with-maven]
60+
runs-on: ubuntu-latest
61+
outputs:
62+
buildName: ${{ steps.output-build-info.outputs.buildName }}
63+
buildNumber: ${{ steps.output-build-info.outputs.buildNumber }}
64+
65+
steps:
66+
- name: Output Build Info
67+
id: output-build-info
68+
run: |
69+
if [ ${{ needs.staging-with-gradle.outputs.buildName }} ]
70+
then
71+
echo buildName=${{ needs.staging-with-gradle.outputs.buildName }} >> $GITHUB_OUTPUT
72+
echo buildNumber=${{ needs.staging-with-gradle.outputs.buildNumber }} >> $GITHUB_OUTPUT
73+
else
74+
echo buildName=${{ needs.staging-with-maven.outputs.buildName }} >> $GITHUB_OUTPUT
75+
echo buildNumber=${{ needs.staging-with-maven.outputs.buildNumber }} >> $GITHUB_OUTPUT
76+
fi

.github/workflows/stage-release.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
version=3.0.5-SNAPSHOT
1+
version=3.0.4-SNAPSHOT
22
org.gradle.caching=true
33
org.gradle.parallel=true

0 commit comments

Comments
 (0)