This repository has been archived by the owner on Jan 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Jenkinsfile
58 lines (56 loc) · 1.68 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
pipeline {
agent any
environment {
// Specified for Jenkins server
JAVA_HOME = "C:/Program Files/Android/Android Studio/jre"
ANDROID_SDK_ROOT = "C:/Android/Sdk"
GRADLE_USER_HOME = "C:/gradle-cache"
KEYSTORE_LOCATION = credentials('nitspec-keystore-location')
}
options {
// Stop the build early in case of compile or test failures
skipStagesAfterUnstable()
}
stages {
stage('Compile') {
steps {
dir('Android') {
bat './gradlew compileDebugSources'
}
}
}
stage('Unit test') {
steps {
dir('Android') {
bat './gradlew testDebugUnitTest testDebugUnitTest'
junit '**/TEST-*.xml' // Enable later when having unit tests to report
}
}
}
stage('Build APK') {
steps {
dir('Android') {
bat './gradlew assembleDebug'
}
}
}
stage('Deploy') {
when {
// Only execute this stage when building from the `master` branch
branch 'master'
}
steps {
dir('Android') {
// Execute bundle release build
bat './gradlew :app:bundleRelease'
// Sign bundle
withCredentials([string(credentialsId: 'nitspec-signing-password', variable: 'nitspec-signing-password')]) {
bat 'jarsigner -verbose -keystore %KEYSTORE_LOCATION% %WORKSPACE%\\Android\\app\\build\\outputs\\bundle\\release\\app-release.aab Nitramite --storepass "%nitspec-signing-password%"'
}
// Archive the AAB (Android App Bundle) so that it can be downloaded from Jenkins
archiveArtifacts '**/bundle/release/*.aab'
}
}
}
}
}