Update release workflows

This commit is contained in:
Janne Valkealahti
2021-04-23 13:53:34 +01:00
parent b9d606767c
commit e5a8efb1a8
2 changed files with 56 additions and 1 deletions

View File

@@ -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

View File

@@ -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