nimbus-site/Jenkinsfile

66 lines
1.4 KiB
Groovy

pipeline {
agent { label 'linux' }
options {
disableConcurrentBuilds()
/* manage how many builds we keep */
buildDiscarder(logRotator(
numToKeepStr: '20',
daysToKeepStr: '30',
))
}
environment {
GIT_USER = 'status-im-auto'
GIT_MAIL = 'auto@status.im'
/* Dev site deployment. */
DEV_SITE = 'dev.nimbus.team'
DEV_HOST = 'jenkins@node-01.do-ams3.sites.misc.statusim.net'
SCP_OPTS = 'StrictHostKeyChecking=no'
}
stages {
stage('Install Deps') {
steps {
sh 'npm install'
}
}
stage('Build') {
steps {
sh 'npm run clean'
sh 'npm run build'
}
}
stage('Robot') {
when { expression { !GIT_BRANCH.endsWith('master') } }
steps { script {
sh 'echo "Disallow: /" >> public/robots.txt'
} }
}
stage('Publish Prod') {
when { expression { GIT_BRANCH.endsWith('master') } }
steps { script {
sshagent(credentials: ['status-im-auto-ssh']) {
sh 'npm run deploy'
}
} }
}
stage('Publish Devel') {
when { expression { !GIT_BRANCH.endsWith('master') } }
steps { script {
sshagent(credentials: ['jenkins-ssh']) {
sh """
rsync -e 'ssh -o ${SCP_OPTS}' -r --delete public/. \
${env.DEV_HOST}:/var/www/${env.DEV_SITE}/
"""
}
} }
}
}
}