use VERSION file for suffix when releasing

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2018-11-27 13:01:34 +01:00 committed by Jakub
parent 6112ca0289
commit d61e838235
2 changed files with 27 additions and 15 deletions

View File

@ -3,8 +3,8 @@ pipeline {
parameters {
booleanParam(
name: 'GITHUB_RELEASE',
description: 'Enable this to create a new GitHub release.',
name: 'RELEASE',
description: 'Enable to create a new release on GitHub and DigitalOcean Space.',
defaultValue: false,
)
}
@ -50,7 +50,7 @@ pipeline {
} } }
stage('Archive') { steps {
sh """
mv ${env.STATUS_PATH}/build/bin/statusgo-android-16.aar \
cp ${env.STATUS_PATH}/build/bin/statusgo-android-16.aar \
${env.WORKSPACE}/status-go-android-${lib.suffix()}.aar
"""
archiveArtifacts("status-go-android-${lib.suffix()}.aar")
@ -58,6 +58,9 @@ pipeline {
stage('Upload') { steps { script {
lib.uploadArtifact("status-go-android-${lib.suffix()}.aar")
} } }
stage('Cleanup') { steps { script {
sh "rm -f ${env.WORKSPACE}/*.aar"
} } }
}
}
stage('iOS') {
@ -70,7 +73,7 @@ pipeline {
} } }
stage('Archive') { steps {
sh """
mv ${env.STATUS_PATH}/build/bin/statusgo-ios-9.3-framework/status-go-ios.zip \
cp ${env.STATUS_PATH}/build/bin/statusgo-ios-9.3-framework/status-go-ios.zip \
${env.WORKSPACE}/status-go-ios-${lib.suffix()}.zip
"""
archiveArtifacts("status-go-ios-${lib.suffix()}.zip")
@ -78,22 +81,27 @@ pipeline {
stage('Upload') { steps { script {
lib.uploadArtifact("status-go-ios-${lib.suffix()}.zip")
} } }
stage('Cleanup') { steps { script {
sh "rm -f ${env.WORKSPACE}/*.zip"
} } }
}
}
}
}
stage('Release') { when { expression { params.GITHUB_RELEASE == true } }
stage('Release') { when { expression { params.RELEASE == true } }
steps {
sh 'make prepare-release'
withCredentials([[
$class: 'UsernamePasswordMultiBinding',
credentialsId: 'status-im-auto',
usernameVariable: 'GITHUB_USER',
passwordVariable: 'GITHUB_TOKEN'
]]) {
sh "yes | make release release_branch=${gitBranch}"
dir(env.STATUS_PATH) {
sh 'make prepare-release'
withCredentials([[
$class: 'UsernamePasswordMultiBinding',
credentialsId: 'status-im-auto',
usernameVariable: 'GITHUB_USER',
passwordVariable: 'GITHUB_TOKEN'
]]) {
sh "yes | make release release_branch=${lib.gitBranch()}"
}
sh 'make clean-release'
}
sh 'make clean-release'
}
}
}

View File

@ -8,7 +8,11 @@ def timestamp() {
}
def suffix() {
return "${timestamp()}-${gitCommit()}"
if (params.RELEASE == true) {
return 'v' + readFile("${env.WORKSPACE}/${env.STATUS_PATH}/VERSION").trim()
} else {
return "${timestamp()}-${gitCommit()}"
}
}
def gitBranch() {