Files
mowesta/Jenkinsfile
T
handte 3c7ed787c9
LocationBasedServices/mowesta/pipeline/head This commit looks good
Upgrade to Android Studio 4.
Upgrade gradle and android plugins.
Replace nodejs gradle plugin with newer version.
Fix (most) linting errors in Android app to prepare for release.
Change FAIR urls in webapp to point to new project site.
Add missing strings for snow shower to webapp.
2020-05-30 15:52:44 +02:00

71 lines
2.4 KiB
Groovy

#!groovy
// this groovy script is executed by jenkins
node {
def gradleInfo
def server = Artifactory.server 'project.nes.uni-due.de'
def gradleBuild = Artifactory.newGradleBuild()
gradleBuild.usesPlugin = true
gradleBuild.useWrapper = true
environment {
ANDROID_SDK_ROOT = '/var/lib/android-sdk'
}
// checkout code from scm
stage('Checkout') {
checkout scm
}
def version = ''
// configure the deployer based on the version
stage('Configure') {
version = sh(returnStdout: true, script: "./gradlew properties -q | grep \"version:\" | awk '{print \$2}'", label: "Detecting project version.").trim()
println "Version is: '${version}'"
if (version.endsWith("-SNAPSHOT")) {
println "Using internal-snapshots for publication."
gradleBuild.deployer server: server, repo: 'internal-snapshots'
} else {
println "Using internal-releases for publication."
gradleBuild.deployer server: server, repo: 'internal-releases'
}
}
// build the source code with gradle
stage('Build') {
withCredentials([string(credentialsId: 'mowesta-keystore-password', variable: 'PASSWD')]) {
def switches = "-Djenkins.build.number=${env.BUILD_NUMBER} -Dandroid.keystore.password=${PASSWD}".toString()
gradleInfo = gradleBuild.run buildFile: 'build.gradle', tasks: 'clean build', switches: switches
}
}
// deploy the maven publications to artifactory
stage ('Publish') {
if (env.BRANCH_NAME == "master") {
withCredentials([string(credentialsId: 'mowesta-keystore-password', variable: 'PASSWD')]) {
def switches = "-Djenkins.build.number=${env.BUILD_NUMBER} -Dandroid.keystore.password=${PASSWD}".toString()
gradleInfo = gradleBuild.run buildFile: 'build.gradle', tasks: 'artifactoryPublish', switches: switches
}
} else {
echo "Skipping deployment for non-master branch."
}
}
// deploy the build output on the server
stage ('Deploy') {
if (env.BRANCH_NAME == "master") {
withCredentials([sshUserPrivateKey(credentialsId: "mowesta-server-key", keyFileVariable: "keyfile")]) {
sh "scp -i ${keyfile} site-ear/build/libs/site-ear-${version}.ear wildfly@apps.nes.uni-due.de:/opt/wildfly-17-mowesta/standalone/deployments/mowesta.ear"
sh "scp -i ${keyfile} android-app/build/outputs/apk/release/*.apk wildfly@apps.nes.uni-due.de:/opt/android/mowesta/"
}
} else {
echo "Skipping deployment for non-master branch."
}
}
}