/ Jenkinsfile
Jenkinsfile
 1  #!/usr/bin/env groovy
 2  library 'status-jenkins-lib@v1.8.8'
 3  
 4  pipeline {
 5    agent { label 'linux' }
 6  
 7    options {
 8      disableConcurrentBuilds()
 9      /* manage how many builds we keep */
10      buildDiscarder(logRotator(
11        numToKeepStr: '20',
12        daysToKeepStr: '30',
13      ))
14    }
15  
16    environment {
17      GIT_COMMITTER_NAME = 'status-im-auto'
18      GIT_COMMITTER_EMAIL = 'auto@status.im'
19    }
20  
21    stages {
22      stage('Install') {
23        steps {
24          sh 'yarn install'
25        }
26      }
27  
28      stage('Build') {
29        steps { script {
30          sh 'yarn build'
31          jenkins.genBuildMetaJSON('build/build.json')
32        } }
33      }
34  
35      stage('Publish') {
36        steps {
37          sshagent(credentials: ['status-im-auto-ssh']) {
38            sh """
39              ghp-import \
40                -b ${deployBranch()} \
41                -c ${deployDomain()} \
42                -p build
43            """
44          }
45        }
46      }
47    }
48  
49    post {
50      cleanup { cleanWs() }
51    }
52  }
53  
54  def isMasterBranch() { GIT_BRANCH ==~ /.*master/ }
55  def deployBranch() { isMasterBranch() ? 'deploy-master' : 'deploy-develop' }
56  def deployDomain() { isMasterBranch() ? 'blog.waku.org' : 'dev-blog.waku.org' }