-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathJenkinsfile
64 lines (62 loc) · 3.25 KB
/
Jenkinsfile
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
pipeline {
agent any
tools {
jdk 'Java17'
}
stages {
stage('Build') {
steps {
sh script: 'chmod +x gradlew'
sh label: 'Gradle Build', script: './gradlew --parallel --max-workers=8 clean bundleRelease assembleRelease'
}
}
stage('Archive Artifacts') {
steps {
archiveArtifacts artifacts: 'app/build/outputs/bundle/release/app-release.aab', followSymlinks: false, onlyIfSuccessful: true
archiveArtifacts artifacts: 'app/build/outputs/apk/release/app-release.apk', followSymlinks: false, onlyIfSuccessful: true
archiveArtifacts artifacts: 'wear/build/outputs/bundle/release/wear-release.aab', followSymlinks: false, onlyIfSuccessful: true
archiveArtifacts artifacts: 'wear/build/outputs/apk/release/wear-release.apk', followSymlinks: false, onlyIfSuccessful: true
}
}
stage('Publish to Play Store') {
steps {
script {
if (env.BRANCH_NAME == 'master') {
echo 'Publishing Bundle to Beta channel (Not allowed to fail)'
androidApkUpload filesPattern: 'app/build/outputs/bundle/release/app-release.aab', googleCredentialsId: 'Florianisme', rolloutPercentage: '20', trackName: 'beta'
androidApkUpload filesPattern: 'wear/build/outputs/bundle/release/wear-release.aab', googleCredentialsId: 'Florianisme', rolloutPercentage: '20', trackName: 'wear:beta'
} else if (env.BRANCH_NAME == 'release') {
echo 'Publishing Bundle to Internal channel (Not allowed to fail)'
androidApkUpload filesPattern: 'app/build/outputs/bundle/release/app-release.aab', googleCredentialsId: 'Florianisme', rolloutPercentage: '100', trackName: 'internal'
androidApkUpload filesPattern: 'wear/build/outputs/bundle/release/wear-release.aab', googleCredentialsId: 'Florianisme', rolloutPercentage: '100', trackName: 'wear:internal'
} else if (env.BRANCH_NAME == 'develop' || env.BRANCH_NAME.contains('feature')) {
echo 'Publishing Bundle to Internal channel (Allowed to fail)'
try {
androidApkUpload filesPattern: 'app/build/outputs/bundle/release/app-release.aab', googleCredentialsId: 'Florianisme', rolloutPercentage: '100', trackName: 'internal'
androidApkUpload filesPattern: 'wear/build/outputs/bundle/release/wear-release.aab', googleCredentialsId: 'Florianisme', rolloutPercentage: '100', trackName: 'wear:internal'
} catch(error) {
currentBuild.result = 'SUCCESS'
}
} else {
echo 'Publishing criteria not met'
}
}
}
}
}
post {
failure {
script {
currentBuild.result = 'FAILURE'
}
}
unstable {
script {
currentBuild.result = 'UNSTABLE'
}
}
always {
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: emailextrecipients([[$class: 'CulpritsRecipientProvider'], [$class: 'RequesterRecipientProvider']])])
}
}
}