2019-05-24 11:59:40 +00:00
|
|
|
pipeline {
|
|
|
|
agent { label 'linux' }
|
|
|
|
|
|
|
|
options {
|
|
|
|
disableConcurrentBuilds()
|
|
|
|
/* manage how many builds we keep */
|
|
|
|
buildDiscarder(logRotator(
|
|
|
|
numToKeepStr: '20',
|
|
|
|
daysToKeepStr: '30',
|
|
|
|
))
|
|
|
|
}
|
|
|
|
|
|
|
|
environment {
|
2022-04-29 09:30:00 +00:00
|
|
|
DEV_HOST = 'jenkins@node-01.do-ams3.sites.misc.statusim.net'
|
2019-05-24 11:59:40 +00:00
|
|
|
DEV_OPTS = '-e "ssh -o StrictHostKeyChecking=no"'
|
2019-05-24 12:28:15 +00:00
|
|
|
DEV_SITE = 'dev-translate'
|
2019-05-24 11:59:40 +00:00
|
|
|
GH_USER = 'status-im-auto'
|
|
|
|
GH_MAIL = 'auto@status.im'
|
|
|
|
GH_REPO = 'translate.status.im'
|
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
|
|
|
stage('Git Prep') {
|
|
|
|
steps {
|
|
|
|
sh "git config user.name ${GH_USER}"
|
|
|
|
sh "git config user.email ${GH_MAIL}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Install Deps') {
|
|
|
|
steps {
|
|
|
|
sh 'yarn install'
|
|
|
|
sh 'yarn upgrade'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Build') {
|
|
|
|
steps {
|
|
|
|
sh 'yarn run clean'
|
|
|
|
sh 'yarn 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 {
|
|
|
|
withCredentials([string(
|
|
|
|
credentialsId: 'jenkins-github-token',
|
|
|
|
variable: 'GH_TOKEN',
|
|
|
|
)]) {
|
|
|
|
sh 'yarn run deploy:ci'
|
|
|
|
}
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Publish Devel') {
|
|
|
|
when { expression { !GIT_BRANCH.endsWith('master') } }
|
|
|
|
steps { script {
|
|
|
|
sshagent(credentials: ['jenkins-ssh']) {
|
2019-05-24 12:28:15 +00:00
|
|
|
sh "rsync ${DEV_OPTS} -r --delete build/. ${DEV_HOST}:/var/www/${DEV_SITE}/"
|
2019-05-24 11:59:40 +00:00
|
|
|
}
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|