File tree Expand file tree Collapse file tree 1 file changed +15
-20
lines changed Expand file tree Collapse file tree 1 file changed +15
-20
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env groovy
2+ 3+
14pipeline {
25 agent { label ' linux' }
36
@@ -13,49 +16,41 @@ pipeline {
1316 environment {
1417 GIT_COMMITTER_NAME = ' status-im-auto'
1518 GIT_COMMITTER_EMAIL = ' [email protected] ' 16- PROD_SITE = ' nimbus.team'
17- DEV_SITE = ' dev.nimbus.team'
18- 19- SCP_OPTS = ' StrictHostKeyChecking=no'
2019 }
2120
2221 stages {
2322 stage(' Install' ) {
2423 steps {
25- sh " yarn install"
24+ sh ' yarn install'
2625 }
2726 }
2827
2928 stage(' Build' ) {
3029 steps {
3130 sh ' yarn build'
32- sh " echo ${ env.PROD_SITE} > build/CNAME"
3331 }
32+ jenkins. genBuildMetaJSON(' build/build.json' )
3433 }
3534
36- stage(' Publish Prod' ) {
37- when { expression { env. GIT_BRANCH ==~ / .*master/ } }
35+ stage(' Publish' ) {
3836 steps {
3937 sshagent(credentials : [' status-im-auto-ssh' ]) {
40- sh " ghp-import -p build"
41- }
42- }
43- }
44-
45- stage(' Publish Devel' ) {
46- when { expression { env. GIT_BRANCH != ~ / .*master/ } }
47- steps {
48- sshagent(credentials : [' jenkins-ssh' ]) {
4938 sh """
50- rsync -e 'ssh -o ${ SCP_OPTS} ' -r --delete build/. \
51- ${ env.DEV_HOST} :/var/www/${ env.DEV_SITE} /
39+ ghp-import \
40+ -b ${ deployBranch()} \
41+ -c ${ deployDomain()} \
42+ -p build
5243 """
5344 }
5445 }
5546 }
56- }
5747
48+ }
5849 post {
5950 cleanup { cleanWs() }
6051 }
6152}
53+
54+ def isMasterBranch () { GIT_BRANCH ==~ / .*master/ }
55+ def deployBranch () { isMasterBranch() ? ' deploy-master' : ' deploy-develop' }
56+ def deployDomain () { isMasterBranch() ? ' nimbus.team' : ' dev.nimbus.team' }
You can’t perform that action at this time.
0 commit comments