/
Jenkinsfile.upload
67 lines (60 loc) · 2.47 KB
/
Jenkinsfile.upload
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
#!/bin/env groovy
node('master'){
def imageName = 'android-browser'
def branchName = "${BRANCH_NAME}"
stage('Checkout'){
checkout scm
}
stage('Build docker image') {
docker.build(imageName, '--build-arg UID=`id -u` --build-arg GID=`id -g` .')
}
docker.image(imageName).inside() {
stage('Extension') {
sh '''
set -x
set -e
yarn
npm run bundle
'''
}
withEnv(["GRADLE_USER_HOME=${pwd()}/gradle_home","BN=${branchName}"]) {
withCredentials([
file(credentialsId: '263e59fb-e9de-4e51-962c-0237c6ee167b', variable: 'CERT_PATH'),
string(credentialsId: '60354bba-8ed0-4df9-8f8e-5be7454c1680', variable: 'CERT_PASS'),
file(credentialsId: '2939d2e1-dd9a-4097-adc2-430e3d67157a', variable: 'PLAY_STORE_CERT')]) {
sh 'echo $BN'
if ("${BN}".contains("-re")) {
stage('Compile') {
sh './gradlew clean assembleStandardFatRelease'
}
}else {
stage('Compile and Upload') {
sh '''#!/bin/bash -l
set -x
set -e
fastlane android alpha
'''
}
}
}
}
}
if ("${branchName}".contains("-re")) {
def id = "Cliqz_Browser_android"+"${branchName}".substring("${branchName}".indexOf("v"), "${branchName}".indexOf("-"))
stage('Upload') {
withCredentials([
[
$class : 'UsernamePasswordMultiBinding',
credentialsId : 'f1732e5f-3e84-47ad-9286-a5fa6657ec43',
passwordVariable: 'AWS_SECRET_ACCESS_KEY',
usernameVariable: 'AWS_ACCESS_KEY_ID',
]
]) {
def s3Path = 's3://repository.cliqz.com/dist/android/release/apk'
def apkPath = "app/build/outputs/apk/standardFat/release/app-standard-fat-release.apk"
sh "aws s3 cp --acl public-read --acl bucket-owner-full-control ${apkPath} ${s3Path}/${id}.apk"
sh "aws s3 cp --acl public-read --acl bucket-owner-full-control ${s3Path}/${id}.apk ${s3Path}/latest.apk"
}
}
}
}