Skip to content

Commit 3c8ec68

Browse files
committed
Push Tag Release step down to the spring-finalize-release.yml
Such a change will allow to avoid rollbacks for those commits when failure happens during release build, especially when Maven Central is not stable
1 parent 11e0a44 commit 3c8ec68

File tree

3 files changed

+44
-24
lines changed

3 files changed

+44
-24
lines changed

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,3 @@ jobs:
9292
artifactoryPassword: ${{ secrets.ARTIFACTORY_PASSWORD }}
9393
gpgPrivateKey: ${{ secrets.GPG_PRIVATE_KEY }}
9494
gpgPassphrase: ${{ secrets.GPG_PASSPHRASE }}
95-
96-
- name: Tag Release and Next Development Version
97-
run: |
98-
git config --global user.name 'Spring Builds'
99-
git config --global user.email '[email protected]'
100-
git commit -a -m "[artifactory-release] Release version ${{ inputs.releaseVersion }}"
101-
git tag "v${{ inputs.releaseVersion }}"
102-
git push --tags origin
103-
gradle nextDevelopmentVersion --no-scan -q
104-
git commit -a -m "[artifactory-release] Next development version"
105-
git push origin

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,16 +124,3 @@ jobs:
124124
threads: 10
125125
signing-key: ${{ secrets.GPG_PRIVATE_KEY }}
126126
signing-passphrase: ${{ secrets.GPG_PASSPHRASE }}
127-
128-
- name: Tag Release and Next Development Version
129-
run: |
130-
git config --global user.name 'Spring Builds'
131-
git config --global user.email '[email protected]'
132-
git commit -a -m "[artifactory-release] Release version ${{ inputs.releaseVersion }}"
133-
git tag "v${{ inputs.releaseVersion }}"
134-
git push --tags origin
135-
mvn build-helper:parse-version versions:set \
136-
-DnewVersion='${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${{ (contains(inputs.releaseVersion, '-M') || contains(inputs.releaseVersion, '-RC')) && '${parsedVersion.incrementalVersion}' || '${parsedVersion.nextIncrementalVersion}' }}'-SNAPSHOT \
137-
-DgenerateBackupPoms=false -DprocessAllModules=true -B -ntp
138-
git commit -a -m "[artifactory-release] Next development version"
139-
git push origin

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

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,50 @@ jobs:
3434
distribution: temurin
3535
java-version: 17
3636

37+
- name: Tag Release and Next Development Version
38+
id: tag-release
39+
run: |
40+
if test -f pom.xml
41+
then
42+
mvn versions:set -DnewVersion=${{ inputs.milestone }} -DgenerateBackupPoms=false -DprocessAllModules=true -B -ntp
43+
else
44+
sed -i "s/version=.*/version=${{ inputs.milestone }}/" gradle.properties
45+
fi
46+
git config --global user.name 'Spring Builds'
47+
git config --global user.email '[email protected]'
48+
git commit -a -m "[artifactory-release] Release version ${{ inputs.milestone }}"
49+
git tag "v${{ inputs.milestone }}"
50+
git push --tags origin
51+
52+
NEXT_VERSION="${{ inputs.milestone }}"
53+
54+
if [[ "$NEXT_VERSION" == *"-"* ]]
55+
then
56+
NEXT_VERSION=${NEXT_VERSION/-*}
57+
else
58+
MAJOR=${NEXT_VERSION/.*}
59+
MINOR_PATCH=${NEXT_VERSION#*.}
60+
MINOR=${MINOR_PATCH/.*}
61+
PATCH_HOT_FIX=${MINOR_PATCH#*.}
62+
PATCH=${PATCH_HOT_FIX/.*}
63+
PATCH=$((PATCH+1))
64+
NEXT_VERSION=$MAJOR.$MINOR.$PATCH
65+
fi
66+
67+
NEXT_VERSION=${NEXT_VERSION}-SNAPSHOT
68+
69+
if test -f pom.xml
70+
then
71+
mvn versions:set -DnewVersion=$NEXT_VERSION -DgenerateBackupPoms=false -DprocessAllModules=true -B -ntp
72+
else
73+
sed -i "s/version=.*/version=$NEXT_VERSION/" gradle.properties
74+
fi
75+
76+
git commit -a -m "[artifactory-release] Next development version"
77+
git push origin
78+
79+
echo nextVersion=$NEXT_VERSION >> $GITHUB_OUTPUT
80+
3781
- name: Changelog Config File
3882
run: |
3983
repositoryTeam=$(gh api repos/$GITHUB_REPOSITORY/collaborators --jq 'map(select(.role_name == "admin") | .login) | tostring')

0 commit comments

Comments
 (0)