codex.storage/Jenkinsfile

64 lines
1.4 KiB
Plaintext
Raw Normal View History

2023-03-16 17:38:15 +00:00
pipeline {
agent { label 'linux' }
options {
disableConcurrentBuilds()
/* manage how many builds we keep */
buildDiscarder(logRotator(
numToKeepStr: '20',
daysToKeepStr: '30',
))
}
environment {
GIT_COMMITTER_NAME = 'status-im-auto'
GIT_COMMITTER_EMAIL = 'auto@status.im'
/* This key is not a secret. */
GHOST_API_KEY = 'dc7884e3d2c10dde2269926b20'
PROD_SITE = 'codex.storage'
DEV_SITE = 'dev.codex.storage'
DEV_HOST = 'jenkins@node-01.do-ams3.sites.misc.statusim.net'
SCP_OPTS = 'StrictHostKeyChecking=no'
2023-03-16 17:38:15 +00:00
}
stages {
stage('Install') {
steps {
sh "yarn install"
}
}
stage('Build') {
steps {
sh 'yarn build'
sh "echo ${env.PROD_SITE} > build/CNAME"
2023-03-16 17:38:15 +00:00
}
}
stage('Publish Prod') {
when { expression { env.GIT_BRANCH ==~ /.*master/ } }
steps {
sshagent(credentials: ['status-im-auto-ssh']) {
sh "ghp-import -p build"
}
}
}
stage('Publish Devel') {
when { expression { env.GIT_BRANCH ==~ /.*develop/ } }
steps {
sshagent(credentials: ['jenkins-ssh']) {
sh """
rsync -e 'ssh -o ${SCP_OPTS}' -r --delete build/. \
${env.DEV_HOST}:/var/www/${env.DEV_SITE}/
"""
}
}
}
}
2023-03-16 18:35:02 +00:00
post {
cleanup { cleanWs() }
}
}