This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9c28763
commit 2b8fd33
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Android Jenkinsfile | ||
*/ | ||
node("Android"){ | ||
stage("Checkout"){ | ||
checkout scm | ||
} | ||
|
||
stage ("Prepare"){ | ||
writeFile file: 'app/src/main/assets/fhconfig.properties', text: params.FH_CONFIG_CONTENT | ||
} | ||
|
||
stage("Build"){ | ||
sh 'chmod +x ./gradlew' | ||
if (params.BUILD_CONFIG == 'release') { | ||
sh './gradlew clean assembleRelease' // builds app/build/outputs/apk/app-release.apk file | ||
} else { | ||
sh './gradlew clean assembleDebug' // builds app/build/outputs/apk/app-debug.apk | ||
} | ||
} | ||
|
||
stage("Sign"){ | ||
if (params.BUILD_CONFIG == 'release') { | ||
signAndroidApks ( | ||
keyStoreId: "${params.BUILD_CREDENTIAL_ID}", | ||
keyAlias: "${params.BUILD_CREDENTIAL_ALIAS}", | ||
apksToSign: "**/*-unsigned.apk", | ||
// uncomment the following line to output the signed APK to a separate directory as described above | ||
// signedApkMapping: [ $class: UnsignedApkBuilderDirMapping ], | ||
// uncomment the following line to output the signed APK as a sibling of the unsigned APK, as described above, or just omit signedApkMapping | ||
// you can override these within the script if necessary | ||
// androidHome: '/usr/local/Cellar/android-sdk' | ||
) | ||
} else { | ||
println('Debug Build - Using default developer signing key') | ||
} | ||
} | ||
|
||
stage("Archive"){ | ||
if (params.BUILD_CONFIG == 'release') { | ||
archiveArtifacts artifacts: 'app/build/outputs/apk/app-release.apk', excludes: 'app/build/outputs/apk/*-unaligned.apk' | ||
} else { | ||
archiveArtifacts artifacts: 'app/build/outputs/apk/app-debug.apk', excludes: 'app/build/outputs/apk/*-unaligned.apk' | ||
} | ||
} | ||
} |