Created
October 12, 2016 12:18
-
-
Save 62mkv/73b47cb077dd4c98350200c57ee511df to your computer and use it in GitHub Desktop.
Pipeline script for Android application with branch-specific config
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
def branch_config = [ master: [target: 'assembleStoreRelease'], qa: [target: 'assembleQaDebug']] | |
node { | |
def branch = env.gitlabSourceBranch | |
stage 'checkout' | |
checkout([$class: 'GitSCM', branches: [[name: "origin/$branch"]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'cbd4ea7d-0718-48ae-a1dd-9dea23ac65bc', url: '[email protected]:group/android.git']]]) | |
stage 'build' | |
gitlabCommitStatus("build") { | |
def target = branch_config["$branch"]['target'] | |
echo "Branch is $branch, target to build is $target" | |
withEnv(['ANDROID_HOME=/opt/android-sdk-linux']) { | |
// sh "./gradlew --info --stacktrace clean $target" | |
} | |
} | |
stage 'deploy' | |
if (branch == 'master') { | |
echo "Deploying master" | |
androidApkUpload apkFilesPattern: 'app/build/outputs/apk/app-store-release.apk', googleCredentialsId: 'Google Play Android Developer (name)', trackName: 'alpha' | |
} else if (branch == 'qa') { | |
echo "Deploying qa" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment