Skip to content

Commit 8577caf

Browse files
authored
Use compute-version and compute-next-snapshot
* Use compute-version in spring-artifactory-gradle-build * Use compute-version in spring-artifactory-maven-release-staging * Use compute-version in spring-artifactory-maven-snapshot * Use compute-next-snapshot in spring-finalize-release * Use compute-version in spring-scheduled-milestone-for-branch Signed-off-by: Josh Cummings <3627351+jzheaux@users.noreply.github.com>
1 parent 6f527d9 commit 8577caf

5 files changed

Lines changed: 30 additions & 27 deletions

File tree

.github/actions/spring-artifactory-gradle-build/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ runs:
5454
with:
5555
java-version: 24
5656

57+
- name: Compute Version
58+
id: compute-version
59+
uses: spring-io/spring-release-actions/compute-version@0.0.3
60+
5761
- name: Set Release Version
5862
if: inputs.releaseVersion
5963
shell: bash
@@ -85,7 +89,7 @@ runs:
8589
branchVersion=${{ github.ref_name }}
8690
8791
if [ $branchVersion = 'main' ]; then
88-
snapshotVersion=$(cat gradle.properties | sed -n '/^version=/ { s/^version=//;p }')
92+
snapshotVersion=${{ steps.compute-version.outputs.version }}
8993
branchVersion=${snapshotVersion%.*}.x
9094
fi
9195

.github/actions/spring-scheduled-milestone-for-branch/action.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ outputs:
99
value: ${{ steps.find-milestone.outputs.milestone }}
1010
currentVersion:
1111
description: 'The version for Milestone to find'
12-
value: ${{ steps.find-milestone.outputs.currentVersion }}
12+
value: ${{ steps.compute-version.outputs.version }}
1313

1414
runs:
1515
using: composite
@@ -20,19 +20,16 @@ runs:
2020
distribution: temurin
2121
java-version: 25
2222

23+
- name: Compute Version
24+
id: compute-version
25+
uses: spring-io/spring-release-actions/compute-version@0.0.3
26+
2327
- name: Find Scheduled Milestone for Current Version in Branch
2428
id: find-milestone
2529
shell: bash
2630
run: |
27-
if test -f pom.xml
28-
then
29-
CURRENT_VERSION=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout)
30-
else
31-
CURRENT_VERSION=$(cat gradle.properties | sed -n '/^version=/ { s/^version=//;p }')
32-
fi
33-
34-
echo currentVersion=$CURRENT_VERSION >> $GITHUB_OUTPUT
35-
31+
CURRENT_VERSION=${{ steps.compute-version.outputs.version }}
32+
3633
export CANDIDATE_VERSION=${CURRENT_VERSION/-SNAPSHOT}
3734
MILESTONE=$(gh api repos/$GITHUB_REPOSITORY/milestones --jq 'map(select(.due_on != null and (.title | startswith(env.CANDIDATE_VERSION)))) | .[0] | .title')
3835

@@ -41,4 +38,4 @@ runs:
4138
echo "::warning title=No scheduled milestone::No scheduled milestone for $CURRENT_VERSION version"
4239
else
4340
echo milestone=$MILESTONE >> $GITHUB_OUTPUT
44-
fi
41+
fi

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,17 @@ jobs:
7676
java-version: 24
7777
cache: maven
7878

79+
- name: Compute Version
80+
id: compute-version
81+
uses: spring-io/spring-release-actions/compute-version@0.0.3
82+
7983
- name: Evaluate Build Name
8084
id: build-name
8185
run: |
8286
branchVersion=${{ github.ref_name }}
8387
8488
if [ $branchVersion = 'main' ]; then
85-
snapshotVersion=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout)
89+
snapshotVersion=${{ steps.compute-version.outputs.version }}
8690
branchVersion=${snapshotVersion%.*}.x
8791
fi
8892

.github/workflows/spring-artifactory-maven-snapshot.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ jobs:
5959
java-version: 24
6060
cache: maven
6161

62+
- name: Compute Version
63+
id: compute-version
64+
uses: spring-io/spring-release-actions/compute-version@0.0.3
65+
6266
- name: Build and Deploy
6367
run: ./mvnw -B -ntp -DaltDeploymentRepository=local::file:deployment-repository ${{ inputs.mavenArgs }} deploy
6468

@@ -70,7 +74,7 @@ jobs:
7074
branchVersion=${{ github.ref_name }}
7175
7276
if [ $branchVersion = 'main' ]; then
73-
snapshotVersion=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout)
77+
snapshotVersion=${{ steps.compute-version.outputs.version }}
7478
branchVersion=${snapshotVersion%.*}.x
7579
fi
7680

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ jobs:
3434
distribution: temurin
3535
java-version: 24
3636

37+
- name: Compute Next Snapshot
38+
id: next-snapshot
39+
uses: spring-io/spring-release-actions/compute-next-snapshot@0.0.3
40+
with:
41+
version: ${{ inputs.milestone }}
42+
3743
- name: Tag Release and Next Development Version
3844
id: tag-release
3945
run: |
@@ -52,19 +58,7 @@ jobs:
5258
git commit -a -m "[CI/CD] Release version ${{ inputs.milestone }}"
5359
git tag "v${{ inputs.milestone }}"
5460
55-
NEXT_VERSION="${{ inputs.milestone }}"
56-
57-
if [[ "$NEXT_VERSION" == *"-"* ]]
58-
then
59-
NEXT_VERSION=${NEXT_VERSION/-*}
60-
else
61-
MAJOR_MINOR=$(echo "$NEXT_VERSION" | cut -d '.' -f1-2)
62-
PATCH=$(echo "$NEXT_VERSION" | cut -d '.' -f3)
63-
PATCH=$((PATCH+1))
64-
NEXT_VERSION=$MAJOR_MINOR.$PATCH
65-
fi
66-
67-
NEXT_VERSION=${NEXT_VERSION}-SNAPSHOT
61+
NEXT_VERSION="${{ steps.next-snapshot.outputs.version }}"
6862
6963
if test -f pom.xml
7064
then

0 commit comments

Comments
 (0)