Skip to content

Commit

Permalink
feat: use two deploy branches for CI builds
Browse files Browse the repository at this point in the history
  • Loading branch information
siddarthkay committed Aug 5, 2024
1 parent 4821317 commit 7851251
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 60 deletions.
49 changes: 24 additions & 25 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.8'

pipeline {
agent { label 'linux' }

Expand All @@ -11,19 +14,14 @@ pipeline {
}

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'
GIT_COMMITTER_NAME = 'status-im-auto'
GIT_COMMITTER_EMAIL = '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'
sh 'yarn clean'
}
}

Expand All @@ -35,31 +33,32 @@ pipeline {

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'
script {
sh 'NODE_OPTIONS=--openssl-legacy-provider yarn build'
jenkins.genBuildMetaJSON('build/build.json')
}
}
}

stage('Publish Devel') {
when { expression { !(env.GIT_BRANCH ==~ /.*master/) } }
stage('Publish') {
steps {
sshagent(credentials: ['jenkins-ssh']) {
sshagent(credentials: ['status-im-auto-ssh']) {
sh """
rsync -e 'ssh -o ${SCP_OPTS}' -r --delete docs/.vuepress/dist/. \
${env.DEV_HOST}:/var/www/${env.DEV_SITE}/
ghp-import \
-b ${deployBranch()} \
-c ${deployDomain()} \
-p build
"""
}
}
}
}
}

post {
cleanup { cleanWs() }
}
}

def isMasterBranch() { GIT_BRANCH ==~ /.*master/ }
def deployBranch() { isMasterBranch() ? 'deploy-master' : 'deploy-develop' }
def deployDomain() { isMasterBranch() ? 'libs.nimbus.team' : 'dev-libs.nimbus.team' }
35 changes: 0 additions & 35 deletions bin/deploy.js

This file was deleted.

0 comments on commit 7851251

Please sign in to comment.