feat: use two deploy branches for CI builds
This way we have two branches on GitHub that reflect the state of the website after CI build has finished and pushed. See README. Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
378518a427
commit
58394dec00
|
@ -16,45 +16,30 @@ pipeline {
|
||||||
environment {
|
environment {
|
||||||
GIT_COMMITTER_NAME = 'status-im-auto'
|
GIT_COMMITTER_NAME = 'status-im-auto'
|
||||||
GIT_COMMITTER_EMAIL = 'auto@status.im'
|
GIT_COMMITTER_EMAIL = 'auto@status.im'
|
||||||
PROD_SITE = 'docs.waku.org'
|
|
||||||
DEV_SITE = 'dev-docs.waku.org'
|
|
||||||
DEV_HOST = 'jenkins@node-01.do-ams3.sites.misc.statusim.net'
|
|
||||||
SCP_OPTS = 'StrictHostKeyChecking=no'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Install') {
|
stage('Install') {
|
||||||
steps {
|
steps {
|
||||||
sh "yarn install"
|
sh 'yarn install'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
steps { script {
|
steps { script {
|
||||||
sh 'yarn build'
|
sh 'yarn build'
|
||||||
dir('build') {
|
jenkins.genBuildMetaJSON('build/build.json')
|
||||||
sh "echo ${env.PROD_SITE} > CNAME"
|
} }
|
||||||
jenkins.genBuildMetaJSON()
|
|
||||||
} }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Publish Prod') {
|
stage('Publish') {
|
||||||
when { expression { env.GIT_BRANCH ==~ /.*master/ } }
|
|
||||||
steps {
|
steps {
|
||||||
sshagent(credentials: ['status-im-auto-ssh']) {
|
sshagent(credentials: ['status-im-auto-ssh']) {
|
||||||
sh "ghp-import -p build"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Publish Devel') {
|
|
||||||
when { expression { env.GIT_BRANCH !=~ /.*master/ } }
|
|
||||||
steps {
|
|
||||||
sshagent(credentials: ['jenkins-ssh']) {
|
|
||||||
sh """
|
sh """
|
||||||
rsync -e 'ssh -o ${SCP_OPTS}' -r --delete build/. \
|
ghp-import \
|
||||||
${env.DEV_HOST}:/var/www/${env.DEV_SITE}/
|
-b ${deployBranch()} \
|
||||||
|
-c ${deployDomain()} \
|
||||||
|
-p build
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,3 +50,7 @@ pipeline {
|
||||||
cleanup { cleanWs() }
|
cleanup { cleanWs() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def isMasterBranch() { GIT_BRANCH ==~ /.*master/ }
|
||||||
|
def deployBranch() { isMasterBranch() ? 'deploy-master' : 'deploy-develop' }
|
||||||
|
def deployDomain() { isMasterBranch() ? 'docs.waku.org' : 'dev-docs.waku.org' }
|
||||||
|
|
11
README.md
11
README.md
|
@ -84,4 +84,13 @@ Docusaurus depends heavily on caching to enhance site performance. If you make c
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
yarn clear
|
yarn clear
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## CI/CD
|
||||||
|
|
||||||
|
- [CI builds](https://ci.infra.status.im/job/website/job/docs.waku.org/) `master` and pushes to `deploy-master` branch, which is hosted at <https://docs.waku.org/>.
|
||||||
|
- [CI builds](https://ci.infra.status.im/job/website/job/dev-docs.waku.org/) `develop` and pushes to `deploy-develop` branch, which is hosted at <https://dev-docs.waku.org/>.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
Loading…
Reference in New Issue