generated from acid-info/logos-documentation-website-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use two deploy branches for CI builds
- Loading branch information
1 parent
3081abf
commit 1119982
Showing
2 changed files
with
24 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
#!/usr/bin/env groovy | ||
library '[email protected]' | ||
|
||
pipeline { | ||
agent { label 'linux' } | ||
|
||
|
@@ -13,44 +16,34 @@ pipeline { | |
environment { | ||
GIT_COMMITTER_NAME = 'status-im-auto' | ||
GIT_COMMITTER_EMAIL = '[email protected]' | ||
PROD_SITE = 'codex.storage' | ||
DEV_SITE = 'dev.codex.storage' | ||
DEV_HOST = '[email protected]' | ||
SCP_OPTS = 'StrictHostKeyChecking=no' | ||
} | ||
|
||
stages { | ||
stage('Install') { | ||
steps { | ||
sh "yarn install" | ||
sh 'yarn install' | ||
} | ||
} | ||
|
||
stage('Build') { | ||
steps { | ||
sh 'yarn build' | ||
sh "echo ${env.PROD_SITE} > build/CNAME" | ||
} | ||
} | ||
|
||
stage('Publish Prod') { | ||
when { expression { env.GIT_BRANCH ==~ /.*master/ } } | ||
steps { | ||
sshagent(credentials: ['status-im-auto-ssh']) { | ||
sh "ghp-import -p build" | ||
script { | ||
sh 'yarn build' | ||
jenkins.genBuildMetaJSON('build/build.json') | ||
} | ||
} | ||
} | ||
|
||
stage('Publish Devel') { | ||
when { expression { env.GIT_BRANCH ==~ /.*develop/ } } | ||
stage('Publish') { | ||
steps { | ||
sshagent(credentials: ['jenkins-ssh']) { | ||
sshagent(credentials: ['status-im-auto-ssh']) { | ||
sh """ | ||
rsync -e 'ssh -o ${SCP_OPTS}' -r --delete build/. \ | ||
${env.DEV_HOST}:/var/www/${env.DEV_SITE}/ | ||
ghp-import \ | ||
-b ${deployBranch()} \ | ||
-c ${deployDomain()} \ | ||
-p build | ||
""" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
@@ -59,3 +52,7 @@ pipeline { | |
cleanup { cleanWs() } | ||
} | ||
} | ||
|
||
def isMasterBranch() { GIT_BRANCH ==~ /.*master/ } | ||
def deployBranch() { isMasterBranch() ? 'deploy-master' : 'deploy-develop' } | ||
def deployDomain() { isMasterBranch() ? 'codex.storage' : 'dev.codex.storage' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters