add Jenkinsfile

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-03-11 16:28:29 +01:00
parent 7c3d3079ef
commit 09affb3d32
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
1 changed files with 65 additions and 0 deletions

65
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,65 @@
pipeline {
agent { label 'linux' }
options {
disableConcurrentBuilds()
/* manage how many builds we keep */
buildDiscarder(logRotator(
numToKeepStr: '20',
daysToKeepStr: '30',
))
}
environment {
SCP_OPTS = 'StrictHostKeyChecking=no'
DEV_HOST = 'jenkins@node-01.do-ams3.proxy.misc.statusim.net'
DEV_SITE = 'dev-libs.nimbus.team'
GH_USER = 'status-im-auto'
GH_MAIL = 'auto@status.im'
}
stages {
stage('Git Prep') {
steps {
sh "git config user.name ${env.GH_USER}"
sh "git config user.email ${env.GH_MAIL}"
sh 'yarn run clean'
}
}
stage('Install Deps') {
steps {
sh 'yarn install --ignore-optional'
}
}
stage('Build') {
steps {
/* We run it twice because VuePress is retarded */
sh 'yarn run build'
sh 'yarn run build'
}
}
stage('Publish Prod') {
when { expression { env.GIT_BRANCH ==~ /.*master/ } }
steps {
sshagent(credentials: ['status-im-auto-ssh']) {
sh 'yarn run deploy'
}
}
}
stage('Publish Devel') {
when { expression { !(env.GIT_BRANCH ==~ /.*master/) } }
steps {
sshagent(credentials: ['jenkins-ssh']) {
sh """
rsync -e 'ssh -o ${SCP_OPTS}' -r --delete docs/.vuepress/dist/. \
${env.DEV_HOST}:/var/www/${env.DEV_SITE}/
"""
}
}
}
}
}