2018-09-01 00:25:22 +00:00
|
|
|
def remote = [:]
|
|
|
|
remote.name = 'budget'
|
|
|
|
remote.host = 'budget.wbrawner.com'
|
|
|
|
remote.user = 'root'
|
|
|
|
remote.identityFile = '/var/lib/jenkins/.ssh/id_rsa'
|
|
|
|
remote.knownHosts = '/var/lib/jenkins/.ssh/known_hosts'
|
|
|
|
|
|
|
|
pipeline {
|
|
|
|
agent any
|
|
|
|
stages {
|
|
|
|
stage('Build') {
|
|
|
|
steps {
|
|
|
|
checkout scm
|
|
|
|
sh 'npm install'
|
|
|
|
sh 'ng build --prod --aot'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Prepare Archive') {
|
|
|
|
steps {
|
|
|
|
sh 'zip -j archive.zip dist/budget/*'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Deploy to Production') {
|
|
|
|
when {
|
|
|
|
expression {
|
|
|
|
env.BRANCH_NAME == 'master'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
steps {
|
2018-09-04 15:14:46 +00:00
|
|
|
withCredentials([string(credentialsId: '4a0b8908-75eb-4bc3-9961-db044f848bc5', variable: 'FIREBASE_DEPLOY_TOKEN')]) {
|
|
|
|
sh 'firebase deploy --token "$FIREBASE_DEPLOY_TOKEN"'
|
|
|
|
}
|
2018-09-01 00:25:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Deploy to Dev') {
|
|
|
|
steps {
|
2018-09-01 15:28:04 +00:00
|
|
|
sh 'rm -rf /var/www/html/*'
|
2018-09-01 01:55:03 +00:00
|
|
|
sh 'cp -rv dist/budget/* /var/www/html/'
|
2018-09-01 00:25:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
archiveArtifacts artifacts: 'archive.zip', fingerprint: true
|
|
|
|
}
|
|
|
|
cleanup {
|
|
|
|
cleanWs()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|