status-go/_assets/ci/Jenkinsfile

106 lines
3.2 KiB
Plaintext
Raw Normal View History

pipeline {
agent { label 'linux' }
parameters {
booleanParam(
name: 'RELEASE',
description: 'Enable to create a new release on GitHub and DigitalOcean Space.',
defaultValue: false,
)
}
options {
disableConcurrentBuilds()
/* Go requires a certain directory structure */
checkoutToSubdirectory('src/github.com/status-im/status-go')
/* manage how many builds we keep */
buildDiscarder(logRotator(
numToKeepStr: '30',
daysToKeepStr: '30',
))
}
environment {
STATUS_PATH = 'src/github.com/status-im/status-go'
GOPATH = "${env.WORKSPACE}"
PATH = "${env.PATH}:${env.GOPATH}/bin"
2019-02-01 17:02:52 +00:00
/* This will override the var in Makefile */
RELEASE_DIRECTORY = "${env.WORKSPACE}/pkg"
}
stages {
stage('Prep') {
steps { script {
lib = load("${env.STATUS_PATH}/_assets/ci/lib.groovy")
version = readFile("${STATUS_PATH}/VERSION").trim()
println("Version: ${version}")
println("Git Branch: ${lib.gitBranch()}")
println("Git Commit: ${lib.gitCommit()}")
} }
2019-02-01 17:02:52 +00:00
} // stage(Prep)
stage('Setup') { steps { dir(env.STATUS_PATH) {
2019-02-01 17:02:52 +00:00
/* install release tools */
sh 'make release-install'
} } } // stage(Setup)
stage('Build') {
parallel {
2019-02-01 17:02:52 +00:00
stage('iOS') { steps { script {
ios = lib.buildBranch('status-go/platforms/ios')
} } }
stage('Android') { steps { script {
android = lib.buildBranch('status-go/platforms/android')
} } }
stage('Linux') { steps { script {
linux = lib.buildBranch('status-go/platforms/linux')
} } }
} // parallel
} // stage(Build)
stage('Archive') {
steps { script {
sh("rm -f ${env.RELEASE_DIRECTORY}/*")
lib.copyArts('status-go/platforms/ios', ios.number)
lib.copyArts('status-go/platforms/android', android.number)
lib.copyArts('status-go/platforms/linux', linux.number)
dir(env.RELEASE_DIRECTORY) {
/* generate sha256 checksums for upload */
sh 'sha256sum * | tee checksum.sha256'
archiveArtifacts('*')
}
2019-02-01 17:02:52 +00:00
} }
} // stage(Archive)
stage('Release') { when { expression { params.RELEASE == true } }
steps {
/* rename build files to not include versions */
dir(env.RELEASE_DIRECTORY) {
sh 'mv status-go-ios-*.zip status-go-ios.zip'
sh 'mv status-go-android-*.aar status-go-android.aar'
sh 'mv status-go-desktop-*.zip status-go-desktop.zip'
}
2019-02-01 17:02:52 +00:00
/* perform the release */
dir(env.STATUS_PATH) {
withCredentials([[
$class: 'UsernamePasswordMultiBinding',
credentialsId: 'status-im-auto',
usernameVariable: 'GITHUB_USER',
passwordVariable: 'GITHUB_TOKEN'
]]) {
sh """
yes | make release \
RELEASE_BRANCH=${lib.gitBranch()} \
RELEASE_DIRECTORY=${env.RELEASE_DIRECTORY}
"""
}
}
}
2019-02-01 17:02:52 +00:00
} // stage(Release)
stage('Cleanup') { steps { dir(env.STATUS_PATH) {
sh 'make clean-release'
} } } // stage(Cleanup)
} // stages
}