Update release Jenkinsfiles to use `cmn` library.
Jenkinsfile.upload_release_android Jenkinsfile.upload_release_ios Signed-off-by: Igor Mandrigin <i@mandrigin.ru>
This commit is contained in:
parent
5f06ebc27d
commit
cd83c7da6d
|
@ -1,102 +1,54 @@
|
||||||
// We need release builds for users who want to test apps, diawi removes old builds and limits downloads, hence the need for Artifactory.
|
pipeline {
|
||||||
// To see env: echo sh(returnStdout: true, script: 'env')
|
agent { label 'linux' }
|
||||||
|
|
||||||
env.LANG="en_US.UTF-8"
|
options {
|
||||||
env.LANGUAGE="en_US.UTF-8"
|
buildDiscarder(logRotator(
|
||||||
env.LC_ALL="en_US.UTF-8"
|
numToKeepStr: '60',
|
||||||
env.FASTLANE_DISABLE_COLORS=1
|
daysToKeepStr: '30',
|
||||||
env.REALM_DISABLE_ANALYTICS=1
|
artifactNumToKeepStr: '60',
|
||||||
|
))
|
||||||
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) {
|
environment {
|
||||||
node ('fastlane'){
|
BUILD_PLATFORM = 'android'
|
||||||
def version
|
LANG = 'en_US.UTF-8'
|
||||||
def build_no
|
LANGUAGE = 'en_US.UTF-8'
|
||||||
|
LC_ALL = 'en_US.UTF-8'
|
||||||
load "$HOME/env.groovy"
|
FASTLANE_DISABLE_COLORS = 1
|
||||||
|
REALM_DISABLE_ANALYTICS = 1
|
||||||
try {
|
BUNDLE_PATH = "${HOME}/.bundle"
|
||||||
|
ANDROID_HOME = '/usr/lib/android-sdk'
|
||||||
stage('Git & Dependencies') {
|
ANDROID_SDK_ROOT = '/usr/lib/android-sdk'
|
||||||
slackSend color: 'good', message: BRANCH_NAME + ' build started. ' + env.BUILD_URL
|
ANDROID_NDK = '/usr/lib/android-ndk'
|
||||||
|
ANDROID_NDK_HOME = '/usr/lib/android-ndk'
|
||||||
if (!BRANCH_NAME.startsWith("release/")){
|
|
||||||
error "Wrong branch name format: " + BRANCH_NAME + ", but it should be `release/version`"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
checkout scm
|
stages {
|
||||||
|
stage('Prep') {
|
||||||
sh 'git fetch --tags'
|
steps { script {
|
||||||
|
/* Necessary to load methods */
|
||||||
sh 'rm -rf node_modules'
|
mobile = load 'ci/mobile.groovy'
|
||||||
sh 'cp .env.prod .env'
|
cmn = load 'ci/common.groovy'
|
||||||
|
mobile.prep('release')
|
||||||
sh 'scripts/prepare-for-platform.sh mobile'
|
} }
|
||||||
version = readFile("${env.WORKSPACE}/VERSION").trim()
|
|
||||||
installJSDeps()
|
|
||||||
|
|
||||||
sh 'mvn -f modules/react-native-status/ios/RCTStatus dependency:unpack'
|
|
||||||
sh 'cd ios && pod install && cd ..'
|
|
||||||
}
|
}
|
||||||
|
stage('Lint') {
|
||||||
stage('Tag Build') {
|
steps { script { cmn.runLint() } }
|
||||||
withCredentials([[
|
|
||||||
$class: 'UsernamePasswordMultiBinding',
|
|
||||||
credentialsId: 'status-im-auto',
|
|
||||||
usernameVariable: 'GIT_USER',
|
|
||||||
passwordVariable: 'GIT_PASS'
|
|
||||||
]]) {
|
|
||||||
build_no = sh(
|
|
||||||
returnStdout: true,
|
|
||||||
script: './scripts/build_no.sh --increment'
|
|
||||||
).trim()
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
stage('Tests') {
|
stage('Tests') {
|
||||||
sh 'lein test-cljs'
|
steps { script { cmn.runTests() } }
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
sh 'lein prod-build'
|
steps { script { mobile.leinBuild('android') } }
|
||||||
}
|
}
|
||||||
|
stage('Compile') {
|
||||||
stage('Build (Android)') {
|
steps { script { apk = mobile.android.compile('release') } }
|
||||||
sh 'cd android && ./gradlew react-native-android:installArchives && ./gradlew assembleRelease -PreleaseVersion=' + version
|
|
||||||
}
|
}
|
||||||
|
stage('Archive') {
|
||||||
stage('Deploy (Android)') {
|
steps { script { archiveArtifacts apk } }
|
||||||
withCredentials([
|
|
||||||
string(
|
|
||||||
credentialsId: "SUPPLY_JSON_KEY_DATA",
|
|
||||||
variable: 'GOOGLE_PLAY_JSON_KEY'
|
|
||||||
),
|
|
||||||
string(
|
|
||||||
credentialsId: "SLACK_URL",
|
|
||||||
variable: 'SLACK_URL'
|
|
||||||
)
|
|
||||||
]) {
|
|
||||||
sh ('bundle exec fastlane android release')
|
|
||||||
}
|
}
|
||||||
}
|
stage('Upload') {
|
||||||
} catch (e) {
|
steps { script { mobile.android.uploadToPlayStore('release') } }
|
||||||
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'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,91 +1,48 @@
|
||||||
// We need release builds for users who want to test apps, diawi removes old builds and limits downloads, hence the need for Artifactory.
|
pipeline {
|
||||||
// To see env: echo sh(returnStdout: true, script: 'env')
|
agent { label 'fastlane' }
|
||||||
|
|
||||||
env.LANG="en_US.UTF-8"
|
options {
|
||||||
env.LANGUAGE="en_US.UTF-8"
|
buildDiscarder(
|
||||||
env.LC_ALL="en_US.UTF-8"
|
logRotator(
|
||||||
env.FASTLANE_DISABLE_COLORS=1
|
numToKeepStr: '30',
|
||||||
env.REALM_DISABLE_ANALYTICS=1
|
daysToKeepStr: '30',
|
||||||
|
artifactNumToKeepStr: '30',
|
||||||
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) {
|
environment {
|
||||||
node ('fastlane'){
|
BUILD_PLATFORM = 'ios'
|
||||||
def version
|
LANG = 'en_US.UTF-8'
|
||||||
def build_no
|
LANGUAGE = 'en_US.UTF-8'
|
||||||
|
LC_ALL = 'en_US.UTF-8'
|
||||||
load "$HOME/env.groovy"
|
FASTLANE_DISABLE_COLORS=1
|
||||||
|
REALM_DISABLE_ANALYTICS=1
|
||||||
try {
|
BUNDLE_PATH = "${HOME}/.bundle"
|
||||||
stage('Git & Dependencies') {
|
}
|
||||||
slackSend color: 'good', message: BRANCH_NAME + ' build started. ' + env.BUILD_URL
|
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Prep') {
|
||||||
|
steps { script {
|
||||||
if (!BRANCH_NAME.startsWith("release/")){
|
if (!BRANCH_NAME.startsWith("release/")){
|
||||||
error "Wrong branch name format: " + BRANCH_NAME + ", but it should be `release/version`"
|
error "Wrong branch name format: " + BRANCH_NAME + ", but it should be `release/<version>`"
|
||||||
}
|
}
|
||||||
|
/* Necessary to load methods */
|
||||||
checkout scm
|
mobile = load 'ci/mobile.groovy'
|
||||||
|
cmn = load 'ci/common.groovy'
|
||||||
sh 'git fetch --tags'
|
mobile.prep('release')
|
||||||
|
} }
|
||||||
sh 'rm -rf node_modules'
|
|
||||||
sh 'cp .env.prod .env'
|
|
||||||
|
|
||||||
sh 'scripts/prepare-for-platform.sh mobile'
|
|
||||||
version = readFile("${env.WORKSPACE}/VERSION").trim()
|
|
||||||
installJSDeps()
|
|
||||||
|
|
||||||
sh 'mvn -f modules/react-native-status/ios/RCTStatus dependency:unpack'
|
|
||||||
sh 'cd ios && pod install && cd ..'
|
|
||||||
}
|
}
|
||||||
|
stage('Lint') {
|
||||||
stage('Tag Build') {
|
steps { script { cmn.runLint() } }
|
||||||
withCredentials([[
|
|
||||||
$class: 'UsernamePasswordMultiBinding',
|
|
||||||
credentialsId: 'status-im-auto',
|
|
||||||
usernameVariable: 'GIT_USER',
|
|
||||||
passwordVariable: 'GIT_PASS'
|
|
||||||
]]) {
|
|
||||||
build_no = sh(
|
|
||||||
returnStdout: true,
|
|
||||||
script: './scripts/build_no.sh --increment'
|
|
||||||
).trim()
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
stage('Tests') {
|
stage('Tests') {
|
||||||
sh 'lein test-cljs'
|
steps { script { cmn.runTests() } }
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
sh 'lein prod-build'
|
steps { script { mobile.leinBuild('ios') } }
|
||||||
}
|
}
|
||||||
|
stage('Compile') {
|
||||||
stage('Build & TestFlight (iOS)') {
|
steps { script { api = mobile.ios.compile('testflight') } }
|
||||||
withCredentials([
|
|
||||||
string(credentialsId: "slave-pass-${env.NODE_NAME}", variable: 'KEYCHAIN_PASSWORD'),
|
|
||||||
string(credentialsId: "SLACK_URL", variable: 'SLACK_URL'),
|
|
||||||
string(credentialsId: 'FASTLANE_PASSWORD', variable: 'FASTLANE_PASSWORD'),
|
|
||||||
string(credentialsId: 'APPLE_ID', variable: 'APPLE_ID'),
|
|
||||||
string(credentialsId: 'fastlane-match-password', variable:'MATCH_PASSWORD')]) {
|
|
||||||
sh "plutil -replace CFBundleShortVersionString -string ${version} ios/StatusIm/Info.plist"
|
|
||||||
sh "plutil -replace CFBundleVersion -string ${build_no} ios/StatusIm/Info.plist"
|
|
||||||
sh 'fastlane ios release'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Slack Notification') {
|
|
||||||
slackSend color: 'good', message: 'Release build ' + version + ' succesfully aploade to iTunes Connect'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@ def compile(type = 'nightly') {
|
||||||
return pkg
|
return pkg
|
||||||
}
|
}
|
||||||
|
|
||||||
def uploadToPlayStore() {
|
def uploadToPlayStore(type = 'nightly') {
|
||||||
withCredentials([
|
withCredentials([
|
||||||
string(credentialsId: "SUPPLY_JSON_KEY_DATA", variable: 'GOOGLE_PLAY_JSON_KEY'),
|
string(credentialsId: "SUPPLY_JSON_KEY_DATA", variable: 'GOOGLE_PLAY_JSON_KEY'),
|
||||||
string(credentialsId: "SLACK_URL", variable: 'SLACK_URL')
|
string(credentialsId: "SLACK_URL", variable: 'SLACK_URL')
|
||||||
]) {
|
]) {
|
||||||
sh 'bundle exec fastlane android nightly'
|
sh "bundle exec fastlane android ${type}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,16 @@ def plutil(name, value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
def compile(type = 'nightly') {
|
def compile(type = 'nightly') {
|
||||||
def target = (type == 'release' ? 'adhoc' : 'nightly')
|
def target = 'nightly'
|
||||||
|
|
||||||
|
if (type == 'release') {
|
||||||
|
target = 'adhoc'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == 'testflight') {
|
||||||
|
target = 'release'
|
||||||
|
}
|
||||||
|
|
||||||
/* configure build metadata */
|
/* configure build metadata */
|
||||||
plutil('CFBundleShortVersionString', common.version())
|
plutil('CFBundleShortVersionString', common.version())
|
||||||
plutil('CFBundleVersion', common.tagBuild())
|
plutil('CFBundleVersion', common.tagBuild())
|
||||||
|
@ -20,10 +29,13 @@ def compile(type = 'nightly') {
|
||||||
]) {
|
]) {
|
||||||
sh "bundle exec fastlane ios ${target}"
|
sh "bundle exec fastlane ios ${target}"
|
||||||
}
|
}
|
||||||
|
if (type != 'testflight') {
|
||||||
def pkg = common.pkgFilename(type, 'ipa')
|
def pkg = common.pkgFilename(type, 'ipa')
|
||||||
sh "cp status-adhoc/StatusIm.ipa ${pkg}"
|
sh "cp status-adhoc/StatusIm.ipa ${pkg}"
|
||||||
return pkg
|
return pkg
|
||||||
}
|
}
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
|
||||||
def uploadToDiawi() {
|
def uploadToDiawi() {
|
||||||
withCredentials([
|
withCredentials([
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
#
|
#
|
||||||
# https://docs.fastlane.tools/actions
|
# https://docs.fastlane.tools/actions
|
||||||
#
|
#
|
||||||
|
# Fastlane is updated quite frequently with security patches
|
||||||
|
# update_fastlane
|
||||||
|
|
||||||
# There are a few env variables defined in the .env file in
|
# There are a few env variables defined in the .env file in
|
||||||
# this directory (fastlane/.env)
|
# this directory (fastlane/.env)
|
||||||
|
|
||||||
# Fastlane is updated quite frequently with security patches
|
|
||||||
update_fastlane
|
|
||||||
|
|
||||||
# unlocks keychain if KEYCHAIN_PASSWORD variable is present
|
# unlocks keychain if KEYCHAIN_PASSWORD variable is present
|
||||||
# (to be used on CI machines)
|
# (to be used on CI machines)
|
||||||
|
|
Loading…
Reference in New Issue