blob: c44268bada08551ed2ea6a2c5749f634ecf76f18 [file] [log] [blame]
class Constants {
static final String RELEASE_BRANCH = 'release'
static final String QA_BUILD = 'Debug'
static final String RELEASE_BUILD = 'Release'
static final String INTERNAL_TRACK = 'internal'
static final String RELEASE_TRACK = 'release'
}
def getBuildType() {
switch (env.BRANCH_NAME) {
case Constants.RELEASE_BRANCH:
return Constants.RELEASE_BUILD
default:
return Constants.QA_BUILD
}
}
def getTrackType() {
switch (env.BRANCH_NAME) {
case Constants.RELEASE_BRANCH:
return Constants.RELEASE_TRACK
default:
return Constants.INTERNAL_TRACK
}
}
def isDeployCandidate() {
return ("${env.BRANCH_NAME}" =~ /(${RELEASE_BRANCH}|main|next)/)
}
pipeline {
agent any
environment {
appName = 'Aperture'
SIGN_STORE = credentials('sign_store_shift_releasekey')
SIGN_STORE_PASS = credentials('sign_store_pass_shift_releasekey')
SIGN_KEY_ALIAS = credentials('sign_key_alias_shift_releasekey')
SIGN_KEY_PASS = credentials('sign_key_pass_shift_releasekey')
}
stages {
stage('Build') {
steps {
echo "Building '$appName'"
script {
VARIANT = getBuildType()
sh('./gradlew \
-Psign_store="$SIGN_STORE" \
-Psign_store_pass="$SIGN_STORE_PASS" \
-Psign_key_alias="$SIGN_KEY_ALIAS" \
-Psign_key_pass="$SIGN_KEY_PASS" '
+ "assemble$VARIANT")
archiveArtifacts \
artifacts: 'app/build/outputs/apk/**/*.apk, app/build/outputs/apk/**/*.json', \
fingerprint: true, \
followSymlinks: false, \
onlyIfSuccessful: true
}
cleanWs()
}
}
}
post {
success {
mattermostSend \
color: 'good', \
message: "SUCCESS -> ${env.JOB_NAME} (#${env.BUILD_NUMBER})\n(<${env.BUILD_URL}|Open>)", \
text: ':android: :bongo_blob: :blob_dance: :bongo_blob: :android:'
}
failure {
mattermostSend \
color: 'danger', \
message: "FAILURE -> ${env.JOB_NAME} (#${env.BUILD_NUMBER})\n(<${env.BUILD_URL}|Open>)", \
text: ':facepalm: :sarcastic: :dull_: :sarcastic: :facepalm:'
}
}
}