-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathJenkinsfile.android
98 lines (82 loc) · 2.89 KB
/
Jenkinsfile.android
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
@Library('conservify') _
properties([
disableConcurrentBuilds(),
buildDiscarder(logRotator(numToKeepStr: '5'))
])
def getBranch(scmInfo) {
def (remoteOrBranch, branch) = scmInfo.GIT_BRANCH.tokenize('/')
if (branch) {
return branch;
}
return remoteOrBranch;
}
timestamps {
node ("jenkins-aws-ubuntu") {
try {
def scmInfo
stage ('git') {
scmInfo = checkout scm
}
stage ("prepare-server") {
// build job: "fk/oss/fancycamera"
// build job: "fk/oss/keyboard-height-provider"
}
stage ("android-sdk") {
sh "rm -f android-sdk-setup.sh*"
sh "wget https://raw.githubusercontent.com/conservify/dev-ops/main/android-sdk/android-sdk-setup.sh"
sh "bash android-sdk-setup.sh"
}
stage ("configuration") {
withCredentials([file(credentialsId: 'app-mapbox-netrc', variable: 'APP_MAPBOX_NETRC')]) {
sh "cp -f $APP_MAPBOX_NETRC ~/.netrc"
}
withCredentials([file(credentialsId: 'app-android-signing-data', variable: 'APP_ANDROID_SIGNING_DATA')]) {
sh "mkdir -p private && cp -f $APP_ANDROID_SIGNING_DATA private/private.zip && (cd private && unzip -o private.zip)"
}
withCredentials([file(credentialsId: 'app-android-google-services', variable: 'APP_ANDROID_GOOGLE_SERVICES')]) {
sh "cp -f $APP_ANDROID_GOOGLE_SERVICES App_Resources/Android"
}
withCredentials([file(credentialsId: 'nativescript-sqlite-commercial', variable: 'APP_NATIVESCRIPT_SQLITE')]) {
sh "cp -f $APP_NATIVESCRIPT_SQLITE ."
sh "unzip -o $APP_NATIVESCRIPT_SQLITE"
}
}
stage ('build') {
def branch = getBranch(scmInfo)
def buildType = "beta"
if (branch == "main") {
buildType = "release"
}
def props = readProperties(file: "private/gradle.properties")
withEnv(["GIT_LOCAL_BRANCH=${branch}"]) {
sh """
export PATH=$PATH:node_modules/.bin
export ANDROID_HOME=`pwd`/android-sdk
export LANG=en_US.UTF-8
export FK_APP_RELEASE_STORE_FILE=private/${props.FK_APP_RELEASE_STORE_FILE}
export FK_APP_RELEASE_KEY_ALIAS=${props.FK_APP_RELEASE_KEY_ALIAS}
set +x
export FK_APP_RELEASE_STORE_PASSWORD=${props.FK_APP_RELEASE_STORE_PASSWORD}
export FK_APP_RELEASE_KEY_PASSWORD=${props.FK_APP_RELEASE_KEY_PASSWORD}
set -x
export BUILD_TYPE=${buildType}
env
make clean-secrets
make android-release
"""
}
}
stage ('archive') {
def version = readFile('version.txt')
currentBuild.description = version.trim()
archiveArtifacts artifacts: 'platforms/android/app/build/outputs/apk/*/*.apk, platforms/android/app/build/outputs/bundle/*/*.aab'
}
refreshDistribution()
notifySuccess()
}
catch (Exception e) {
notifyFailure()
throw e;
}
}
}