/ 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 disableRestartFromStage() 9 disableConcurrentBuilds() 10 /* manage how many builds we keep */ 11 buildDiscarder(logRotator( 12 numToKeepStr: '20', 13 daysToKeepStr: '30', 14 )) 15 } 16 17 environment { 18 GIT_COMMITTER_NAME = 'status-im-auto' 19 GIT_COMMITTER_EMAIL = 'auto@status.im' 20 } 21 22 stages { 23 stage('Install') { 24 steps { 25 script { 26 nix.develop('yarn install') 27 } 28 } 29 } 30 31 stage('Build') { 32 steps { 33 script { 34 nix.develop('yarn build') 35 jenkins.genBuildMetaJSON('dist/build.json') 36 } 37 } 38 } 39 40 stage('Publish') { 41 steps { 42 sshagent(credentials: ['status-im-auto-ssh']) { 43 script { 44 nix.develop(""" 45 ghp-import \ 46 -b ${deployBranch()} \ 47 -c ${deployDomain()} \ 48 -p dist 49 """ 50 ) 51 } 52 } 53 } 54 } 55 } 56 57 post { 58 cleanup { cleanWs() } 59 } 60 } 61 62 def isMasterBranch() { GIT_BRANCH ==~ /.*master/ } 63 def deployBranch() { isMasterBranch() ? 'deploy-master' : 'deploy-develop' } 64 def deployDomain() { isMasterBranch() ? 'master-exit.logos.co' : 'dev-exit.logos.co' }