diff --git a/.github/actions/spring-artifactory-gradle-build/action.yml b/.github/actions/spring-artifactory-gradle-build/action.yml index 6c09281..a3e3104 100644 --- a/.github/actions/spring-artifactory-gradle-build/action.yml +++ b/.github/actions/spring-artifactory-gradle-build/action.yml @@ -54,6 +54,10 @@ runs: with: java-version: 24 + - name: Compute Version + id: compute-version + uses: spring-io/spring-release-actions/compute-version@0.0.3 + - name: Set Release Version if: inputs.releaseVersion shell: bash @@ -85,7 +89,7 @@ runs: branchVersion=${{ github.ref_name }} if [ $branchVersion = 'main' ]; then - snapshotVersion=$(cat gradle.properties | sed -n '/^version=/ { s/^version=//;p }') + snapshotVersion=${{ steps.compute-version.outputs.version }} branchVersion=${snapshotVersion%.*}.x fi diff --git a/.github/actions/spring-scheduled-milestone-for-branch/action.yml b/.github/actions/spring-scheduled-milestone-for-branch/action.yml index c2c59a2..c59f4fd 100644 --- a/.github/actions/spring-scheduled-milestone-for-branch/action.yml +++ b/.github/actions/spring-scheduled-milestone-for-branch/action.yml @@ -9,7 +9,7 @@ outputs: value: ${{ steps.find-milestone.outputs.milestone }} currentVersion: description: 'The version for Milestone to find' - value: ${{ steps.find-milestone.outputs.currentVersion }} + value: ${{ steps.compute-version.outputs.version }} runs: using: composite @@ -20,19 +20,16 @@ runs: distribution: temurin java-version: 25 + - name: Compute Version + id: compute-version + uses: spring-io/spring-release-actions/compute-version@0.0.3 + - name: Find Scheduled Milestone for Current Version in Branch id: find-milestone shell: bash run: | - if test -f pom.xml - then - CURRENT_VERSION=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout) - else - CURRENT_VERSION=$(cat gradle.properties | sed -n '/^version=/ { s/^version=//;p }') - fi - - echo currentVersion=$CURRENT_VERSION >> $GITHUB_OUTPUT - + CURRENT_VERSION=${{ steps.compute-version.outputs.version }} + export CANDIDATE_VERSION=${CURRENT_VERSION/-SNAPSHOT} MILESTONE=$(gh api repos/$GITHUB_REPOSITORY/milestones --jq 'map(select(.due_on != null and (.title | startswith(env.CANDIDATE_VERSION)))) | .[0] | .title') @@ -41,4 +38,4 @@ runs: echo "::warning title=No scheduled milestone::No scheduled milestone for $CURRENT_VERSION version" else echo milestone=$MILESTONE >> $GITHUB_OUTPUT - fi \ No newline at end of file + fi diff --git a/.github/workflows/spring-artifactory-maven-release-staging.yml b/.github/workflows/spring-artifactory-maven-release-staging.yml index dfc1cb2..7818a98 100644 --- a/.github/workflows/spring-artifactory-maven-release-staging.yml +++ b/.github/workflows/spring-artifactory-maven-release-staging.yml @@ -76,13 +76,17 @@ jobs: java-version: 24 cache: maven + - name: Compute Version + id: compute-version + uses: spring-io/spring-release-actions/compute-version@0.0.3 + - name: Evaluate Build Name id: build-name run: | branchVersion=${{ github.ref_name }} if [ $branchVersion = 'main' ]; then - snapshotVersion=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout) + snapshotVersion=${{ steps.compute-version.outputs.version }} branchVersion=${snapshotVersion%.*}.x fi diff --git a/.github/workflows/spring-artifactory-maven-snapshot.yml b/.github/workflows/spring-artifactory-maven-snapshot.yml index fe452aa..30b4a9e 100644 --- a/.github/workflows/spring-artifactory-maven-snapshot.yml +++ b/.github/workflows/spring-artifactory-maven-snapshot.yml @@ -59,6 +59,10 @@ jobs: java-version: 24 cache: maven + - name: Compute Version + id: compute-version + uses: spring-io/spring-release-actions/compute-version@0.0.3 + - name: Build and Deploy run: ./mvnw -B -ntp -DaltDeploymentRepository=local::file:deployment-repository ${{ inputs.mavenArgs }} deploy @@ -70,7 +74,7 @@ jobs: branchVersion=${{ github.ref_name }} if [ $branchVersion = 'main' ]; then - snapshotVersion=$(mvn help:evaluate -Dexpression="project.version" -q -DforceStdout) + snapshotVersion=${{ steps.compute-version.outputs.version }} branchVersion=${snapshotVersion%.*}.x fi diff --git a/.github/workflows/spring-finalize-release.yml b/.github/workflows/spring-finalize-release.yml index 840aa4d..3ce175b 100644 --- a/.github/workflows/spring-finalize-release.yml +++ b/.github/workflows/spring-finalize-release.yml @@ -34,6 +34,12 @@ jobs: distribution: temurin java-version: 24 + - name: Compute Next Snapshot + id: next-snapshot + uses: spring-io/spring-release-actions/compute-next-snapshot@0.0.3 + with: + version: ${{ inputs.milestone }} + - name: Tag Release and Next Development Version id: tag-release run: | @@ -52,19 +58,7 @@ jobs: git commit -a -m "[CI/CD] Release version ${{ inputs.milestone }}" git tag "v${{ inputs.milestone }}" - NEXT_VERSION="${{ inputs.milestone }}" - - if [[ "$NEXT_VERSION" == *"-"* ]] - then - NEXT_VERSION=${NEXT_VERSION/-*} - else - MAJOR_MINOR=$(echo "$NEXT_VERSION" | cut -d '.' -f1-2) - PATCH=$(echo "$NEXT_VERSION" | cut -d '.' -f3) - PATCH=$((PATCH+1)) - NEXT_VERSION=$MAJOR_MINOR.$PATCH - fi - - NEXT_VERSION=${NEXT_VERSION}-SNAPSHOT + NEXT_VERSION="${{ steps.next-snapshot.outputs.version }}" if test -f pom.xml then