[#4292] Use separate jobs to upload files to iTC and Google Play.

Signed-off-by: Igor Mandrigin <i@mandrigin.ru>
This commit is contained in:
Igor Mandrigin 2018-05-24 15:41:41 +02:00
parent a307d8e2d0
commit 76f5f020ef
No known key found for this signature in database
GPG Key ID: 4A0EDDE26E66BC8B
2 changed files with 91 additions and 12 deletions

View File

@ -0,0 +1,89 @@
// We need release builds for users who want to test apps, diawi removes old builds and limits downloads, hence the need for Artifactory.
// To see env: echo sh(returnStdout: true, script: 'env')
env.LANG="en_US.UTF-8"
env.LANGUAGE="en_US.UTF-8"
env.LC_ALL="en_US.UTF-8"
def installJSDeps() {
def attempt = 1
def maxAttempts = 10
def installed = false
while (!installed && attempt <= maxAttempts) {
println "#${attempt} attempt to install npm deps"
sh 'npm install'
installed = fileExists('node_modules/web3/index.js')
attemp = attempt + 1
}
}
timeout(90) {
node ('macos'){
def apkUrl = ''
def ipaUrl = ''
def testPassed = true
def version
load "$HOME/env.groovy"
try {
stage('Git & Dependencies') {
slackSend color: 'good', message: BRANCH_NAME + ' build started. ' + env.BUILD_URL
if (!BRANCH_NAME.startsWith("release/")){
error "Wrong branch name format: " + BRANCH_NAME + ", but it should be `release/version`"
}
checkout scm
version = readFile("${env.WORKSPACE}/VERSION").trim()
sh 'echo "' + version + '" > .version'
sh 'git fetch --tags'
sh 'rm -rf node_modules'
sh 'cp .env.prod .env'
sh 'lein deps'
installJSDeps()
sh 'mvn -f modules/react-native-status/ios/RCTStatus dependency:unpack'
sh 'cd ios && pod install && cd ..'
}
stage('Tests') {
sh 'lein test-cljs'
}
stage('Build') {
sh 'lein prod-build'
}
stage('Build (Android)') {
sh 'cd android && ./gradlew assembleRelease -PreleaseVersion=' + version
}
stage('Deploy (Android)') {
sh ('bundle exec fastlane android release')
}
stage('Push build tag') {
withCredentials([[
$class: 'UsernamePasswordMultiBinding',
credentialsId: 'jenkins-status-im',
usernameVariable: 'GIT_USER',
passwordVariable: 'GIT_PASS'
]]) {
sh ('git push --tags https://${GIT_USER}:${GIT_PASS}@github.com/status-im/status-react --tags')
}
}
} catch (e) {
slackSend color: 'bad', message: 'Release build failed uploading to the Play Market. ' + env.BUILD_URL
throw e
}
stage('Slack Notification') {
slackSend color: 'good', message: 'Release build ' + version + ' succesfully aploade to the Play Market'
}
}
}

View File

@ -27,7 +27,6 @@ timeout(90) {
load "$HOME/env.groovy" load "$HOME/env.groovy"
try { try {
stage('Git & Dependencies') { stage('Git & Dependencies') {
slackSend color: 'good', message: BRANCH_NAME + ' build started. ' + env.BUILD_URL slackSend color: 'good', message: BRANCH_NAME + ' build started. ' + env.BUILD_URL
@ -58,10 +57,6 @@ timeout(90) {
sh 'lein prod-build' sh 'lein prod-build'
} }
stage('Build (Android)') {
sh 'cd android && ./gradlew assembleRelease -PreleaseVersion=' + version
}
stage('Build (iOS)') { stage('Build (iOS)') {
withCredentials([string(credentialsId: 'jenkins_pass', variable: 'password')]) { withCredentials([string(credentialsId: 'jenkins_pass', variable: 'password')]) {
def build_no = sh(returnStdout: true, script: './scripts/build_no.sh --tag').trim() def build_no = sh(returnStdout: true, script: './scripts/build_no.sh --tag').trim()
@ -73,15 +68,10 @@ timeout(90) {
} }
} }
stage('Deploy (Android)') {
sh ('bundle exec fastlane android release')
}
stage('Deploy (iOS)') { stage('Deploy (iOS)') {
sh ('bundle exec fastlane ios release') sh ('bundle exec fastlane ios release')
} }
stage('Push build tag') { stage('Push build tag') {
withCredentials([[ withCredentials([[
$class: 'UsernamePasswordMultiBinding', $class: 'UsernamePasswordMultiBinding',
@ -93,12 +83,12 @@ timeout(90) {
} }
} }
} catch (e) { } catch (e) {
slackSend color: 'bad', message: 'Release build failed uploading to iTC/Play Market. ' + env.BUILD_URL slackSend color: 'bad', message: 'Release build failed uploading to iTunes Connect. ' + env.BUILD_URL
throw e throw e
} }
stage('Slack Notification') { stage('Slack Notification') {
slackSend color: 'good', message: 'Release build ' + version + ' succesfully aploade to iTC/Play Market' slackSend color: 'good', message: 'Release build ' + version + ' succesfully aploade to iTunes Connect'
} }
} }
} }