From 9c1e7264dfbb80f9d1403e2018a155f6fb2aed03 Mon Sep 17 00:00:00 2001 From: Alfredo Gutierrez Date: Mon, 5 Aug 2024 12:52:37 -0600 Subject: [PATCH] Adding gradle task to bumpVersion on gradle.properties and Chart.yaml Also improvements to the WF to be able to bump the version. Signed-off-by: Alfredo Gutierrez --- .github/workflows/release-automation.yaml | 10 +++++--- charts/hedera-block-node/Chart.yaml | 2 +- server/build.gradle.kts | 29 +++++++++++++++++++++++ 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-automation.yaml b/.github/workflows/release-automation.yaml index abfb26dc1..89e8a6c0e 100644 --- a/.github/workflows/release-automation.yaml +++ b/.github/workflows/release-automation.yaml @@ -99,8 +99,12 @@ jobs: git checkout ${RELEASE_BRANCH} fi - - name: Gradle Release - run: ./gradlew release -Pversion=${{ env.VERSION }} + # task is currently failing due to needing credentials.username for PublishToMavenRepository task + #- name: Gradle Release + # run: ./gradlew release -Pversion=${{ env.VERSION }} + + - name: Bump Version + run: ./gradlew bumpVersion -Pversion=${{ env.VERSION }} - name: Close the Milestone if: ${{ steps.version_parser.outputs.prerelease == '' }} @@ -186,7 +190,7 @@ jobs: git reset --hard $RELEASE_BRANCH - name: Gradle Release for Next Minor Snapshot - run: ./gradlew release -Pversion=${{ env.NEXT_VERSION_SNAPSHOT }} + run: ./gradlew bumpVersion -Pversion=${{ env.NEXT_VERSION_SNAPSHOT }} - name: Create Pull Request uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0 diff --git a/charts/hedera-block-node/Chart.yaml b/charts/hedera-block-node/Chart.yaml index 19c33f981..f2e2b33aa 100644 --- a/charts/hedera-block-node/Chart.yaml +++ b/charts/hedera-block-node/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 -appVersion: "0.1.0-SNAPSHOT" +appVersion: 0.1.0-SNAPSHOT description: A Helm chart for Hedera Block Node home: https://github.com/hashgraph/hedera-block-node keywords: diff --git a/server/build.gradle.kts b/server/build.gradle.kts index ff5bf64d2..7ea83e2a9 100644 --- a/server/build.gradle.kts +++ b/server/build.gradle.kts @@ -31,6 +31,35 @@ testModuleInfo { requiresStatic("com.github.spotbugs.annotations") } +// Release related tasks + +fun replaceVersion(files: String, match: String) { + ant.withGroovyBuilder { + "replaceregexp"( + "match" to match, + "replace" to project.version, + "flags" to "gm" + ) { + "fileset"( + "dir" to rootProject.projectDir, + "includes" to files, + "excludes" to "**/node_modules/" + ) + } + } +} + +tasks.register("bumpVersion") { + description = "Bump versions of the project" + group = "release" + + replaceVersion("charts/**/Chart.yaml", "(?<=^(appVersion|version): ).+") + replaceVersion("gradle.properties", "(?<=^version=).+") +} + + +// Docker related tasks + var updateDockerEnv = tasks.register("updateDockerEnv") { description =