diff --git a/_assets/ci/Jenkinsfile b/_assets/ci/Jenkinsfile index ebbf4f03a..ae411aec8 100644 --- a/_assets/ci/Jenkinsfile +++ b/_assets/ci/Jenkinsfile @@ -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' } } } diff --git a/_assets/ci/lib.groovy b/_assets/ci/lib.groovy index ce76b93eb..02a8d7410 100644 --- a/_assets/ci/lib.groovy +++ b/_assets/ci/lib.groovy @@ -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() {