waku.org/Jenkinsfile
Jakub Sokołowski 64d5b7fbbe
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>
2024-02-20 10:14:31 +01:00

65 lines
1.3 KiB
Groovy

#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.8'
pipeline {
agent { label 'linux' }
options {
disableConcurrentBuilds()
/* manage how many builds we keep */
buildDiscarder(logRotator(
numToKeepStr: '20',
daysToKeepStr: '30',
))
}
environment {
GIT_COMMITTER_NAME = 'status-im-auto'
GIT_COMMITTER_EMAIL = 'auto@status.im'
}
stages {
stage('Install') {
steps {
sh 'yarn install'
}
}
stage('Build') {
steps { script {
/* Issues from waku-org/bounties are fetched. */
withCredentials([
string(
credentialsId: 'waku-org-bounties-access-gh-token',
variable: 'GITHUB_ACCESS_TOKEN'
),
]) {
sh 'yarn build'
}
jenkins.genBuildMetaJSON('build/build.json')
} }
}
stage('Publish') {
steps {
sshagent(credentials: ['status-im-auto-ssh']) {
sh """
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() ? 'waku.org' : 'dev.waku.org' }