diff --git a/.github/workflows/release-ga.yml b/.github/workflows/release-ga.yml index fe176c82..fecb61c6 100644 --- a/.github/workflows/release-ga.yml +++ b/.github/workflows/release-ga.yml @@ -35,7 +35,7 @@ jobs: --server-id-deploy=repo.spring.io \ --repo-resolve=libs-release \ --repo-deploy=libs-staging-local - echo JFROG_CLI_BUILD_NAME=spring-statemachine-main-release >> $GITHUB_ENV + echo JFROG_CLI_BUILD_NAME=spring-statemachine-30x-release >> $GITHUB_ENV echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV # switch from snapshot to a release version and extract project # version to get used with tagging diff --git a/build.gradle b/build.gradle index 613189b0..e17d21ff 100644 --- a/build.gradle +++ b/build.gradle @@ -783,6 +783,61 @@ configure(rootProject) { } } + task nextVersion { + doLast{ + def properties = new Properties() + def file = new File('gradle.properties') + properties.load(file.newDataInputStream()) + def currentVersion = properties.getProperty('version') + if (currentVersion.indexOf('-SNAPSHOT') < 0) { + throw new GradleException('Version is a non SNAPSHOT version') + } else { + def (major, minor, patch) = version.tokenize('.') + patch = patch.replace('-SNAPSHOT', '') + patch = String.valueOf(patch.toInteger() + 1) + def nextVersion = major + '.' + minor + '.' + patch + '-SNAPSHOT' + properties.setProperty('version', nextVersion) + properties.store(file.newWriter(), null) + } + } + } + + task milestoneVersion { + doLast{ + def postfix = project.getProperty('statemachineMilestone') + if (!(postfix ==~ /(?:M|RC)\d+/)) { + throw new GradleException('Illegal milestone version') + } + def properties = new Properties() + def file = new File('gradle.properties') + properties.load(file.newDataInputStream()) + def currentVersion = properties.getProperty('version') + if (currentVersion.indexOf('-SNAPSHOT') > 0) { + def nextVersion = currentVersion - '-SNAPSHOT' + '-' + postfix + properties.setProperty('version', nextVersion) + properties.store(file.newWriter(), null) + } else { + throw new GradleException('Version is not a SNAPSHOT version') + } + } + } + + task releaseVersion { + doLast{ + def properties = new Properties() + def file = new File('gradle.properties') + properties.load(file.newDataInputStream()) + def currentVersion = properties.getProperty('version') + if (currentVersion.indexOf('-SNAPSHOT') > 0) { + def nextVersion = currentVersion - '-SNAPSHOT' + properties.setProperty('version', nextVersion) + properties.store(file.newWriter(), null) + } else { + throw new GradleException('Version is not a SNAPSHOT version') + } + } + } + artifacts { archives docsZip archives distZip