diff --git a/Jenkinsfile b/Jenkinsfile index 09221cce..31e302f5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,16 +16,12 @@ pipeline { environment { GIT_COMMITTER_NAME = 'status-im-auto' GIT_COMMITTER_EMAIL = 'auto@status.im' - PROD_SITE = 'waku.org' - DEV_SITE = 'dev.waku.org' - DEV_HOST = 'jenkins@node-01.do-ams3.sites.misc.statusim.net' - SCP_OPTS = 'StrictHostKeyChecking=no' } stages { stage('Install') { steps { - sh "yarn install" + sh 'yarn install' } } @@ -40,29 +36,18 @@ pipeline { ]) { sh 'yarn build' } - dir('build') { - sh "echo ${env.PROD_SITE} > CNAME" - jenkins.genBuildMetaJSON() - } + jenkins.genBuildMetaJSON('build/build.json') } } } - stage('Publish Prod') { - when { expression { env.GIT_BRANCH ==~ /.*master/ } } + stage('Publish') { 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}/ + ghp-import \ + -b ${deployBranch()} \ + -c ${deployDomain()} \ + -p build """ } } @@ -73,3 +58,7 @@ pipeline { cleanup { cleanWs() } } } + +def isMasterBranch() { GIT_BRANCH ==~ /.*master/ } +def deployBranch() { isMasterBranch() ? 'deploy-master' : 'deploy-develop' } +def deployDomain() { isMasterBranch() ? 'waku.org' : 'dev.waku.org' } diff --git a/README.md b/README.md index 026aa782..e9e0f121 100644 --- a/README.md +++ b/README.md @@ -71,9 +71,12 @@ $ yarn serve ## CI/CD -- The `master` branch is automatically deployed to the production server (e.g., logos.co) through [CI](https://ci.infra.status.im) -- The `develop` branch is automatically deployed to the staging server (e.g., dev.logos.co) through [CI](https://ci.infra.status.im) +- [CI builds](https://ci.infra.status.im/job/website/job/waku.org/) `master` and pushes to `deploy-master` branch, which is hosted at . +- [CI builds](https://ci.infra.status.im/job/website/job/waku.org/) `develop` and pushes to `deploy-develop` branch, which is hosted at . +The hosting is done using [Caddy server with Git plugin for handling GitHub webhooks](https://github.com/status-im/infra-misc/blob/master/ansible/roles/caddy-git). + +Information about deployed build can be also found in `/build.json` available on the website. ## Change Process