Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save indranil32/b36450f33a94a8f2ea51f4f9bbece0ff to your computer and use it in GitHub Desktop.
Save indranil32/b36450f33a94a8f2ea51f4f9bbece0ff to your computer and use it in GitHub Desktop.
stage('Upload APK to internal Nexus') {
environment {
// the creds your Jenkins use to communicate with your nexus
JENKINS_USER_CREDS = credentials('jenkins-user-password')
ENV_NAME = "${env.BRANCH_NAME}"
}
when {
anyOf {
// choose what kinds of builds you want to arhive in your nexus
branch 'develop';
tag "*"
}
}
steps {
echo 'Publishing Branch: ' + ENV_NAME
dir("${env.WORKSPACE}/android") {
sh 'chmod +x ./gradlew'
sh "./gradlew publish -PuploadRepoUsername=$JENKINS_USER_CREDS_USR -PuploadRepoPassword=$JENKINS_USER_CREDS_PSW -PuploadBuildNumber=${env.BUILD_NUMBER}"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment