-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
86 lines (65 loc) · 2.78 KB
/
Jenkinsfile
File metadata and controls
86 lines (65 loc) · 2.78 KB
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
pipeline {
agent { label 'linux' }
options {
buildDiscarder(logRotator(artifactDaysToKeepStr: '30', artifactNumToKeepStr: '10'))
}
stages {
stage('Android bundle AAB') {
agent { label 'linux' }
when {
tag "release-android-*";
}
environment {
ANDROID_PSIPHON_CONFIG = 'op://Jenkins/Conduit Psiphon Config/android_psiphon_config'
ANDROID_EMBEDDED_SERVER_ENTRIES = 'op://Jenkins/Conduit Psiphon Config/android_embedded_server_entries'
ANDROID_UPLOAD_KEYSTORE = 'op://Jenkins/Conduit Upload Signing Key/upload-keystore.jks.base64'
ANDROID_UPLOAD_KEYSTORE_PROPERTIES = 'op://Jenkins/Conduit Upload Signing Key/keystore.properties'
}
steps {
sh 'npm ci'
script {
releaseName = TAG_NAME.minus("release-android-")
}
writeFile file: 'src/git-hash.js', text: "export const GIT_HASH = '${releaseName}';"
dir('android') {
withSecrets() {
writeFile file: 'app/src/main/res/raw/psiphon_config', text: env.ANDROID_PSIPHON_CONFIG
writeFile file: 'app/src/main/res/raw/embedded_server_entries', text: env.ANDROID_EMBEDDED_SERVER_ENTRIES
writeFile file: 'app/upload-keystore.jks', text: env.ANDROID_UPLOAD_KEYSTORE, encoding: "Base64"
writeFile file: 'keystore.properties', text: env.ANDROID_UPLOAD_KEYSTORE_PROPERTIES
}
sh './gradlew clean bundleRelease'
sh "mv app/build/outputs/bundle/release/app-release.aab app/build/outputs/bundle/release/conduit-${releaseName}.aab"
}
archiveArtifacts artifacts: 'android/app/build/outputs/bundle/release/*.aab', fingerprint: true, onlyIfSuccessful: true
}
}
}
post {
always {
dir('client') {
// This is very large, save space on jenkins
sh 'rm -rf node_modules'
}
}
failure {
script {
changes = getChangeList()
}
slackSend message:"${env.JOB_NAME} - Build #${env.BUILD_NUMBER} failed (<${env.BUILD_URL}|Open>)\nChanges:\n${changes}",
color: "danger"
}
}
}
String getChangeList() {
if (currentBuild.changeSets.size() == 0) {
return "No changes"
}
def changeList = ""
for (changeSet in currentBuild.changeSets) {
for (entry in changeSet.items) {
changeList += "- ${entry.msg} [${entry.authorName}]\n"
}
}
return changeList
}