/ Jenkinsfile
Jenkinsfile
1 #!/usr/bin/env groovy 2 library 'status-jenkins-lib@v1.8.8' 3 4 pipeline { 5 agent { 6 docker { 7 label 'linuxcontainer' 8 image 'harbor.status.im/infra/ci-build-containers:linux-base-1.0.0' 9 args '--volume=/nix:/nix ' + 10 '--volume=/etc/nix:/etc/nix ' + 11 '--user jenkins' 12 } 13 } 14 15 options { 16 disableConcurrentBuilds() 17 /* manage how many builds we keep */ 18 buildDiscarder(logRotator( 19 numToKeepStr: '20', 20 daysToKeepStr: '30', 21 )) 22 } 23 24 environment { 25 GIT_COMMITTER_NAME = 'status-im-auto' 26 GIT_COMMITTER_EMAIL = 'auto@status.im' 27 NODE_OPTIONS = '--openssl-legacy-provider' 28 } 29 30 stages { 31 stage('Git Prep') { 32 steps { 33 script { 34 nix.develop('yarn clean', pure: false) 35 } 36 } 37 } 38 39 stage('Install Deps') { 40 steps { 41 script { 42 nix.develop('yarn install --ignore-optional', pure: false) 43 } 44 } 45 } 46 47 stage('Build') { 48 steps { 49 script { 50 nix.develop('yarn build', pure: false) 51 /* We run it again because VuePress is retarded */ 52 nix.develop('yarn build', pure: false) 53 jenkins.genBuildMetaJSON('docs/.vuepress/dist/build.json') 54 } 55 } 56 } 57 58 stage('Publish') { 59 steps { 60 sshagent(credentials: ['status-im-auto-ssh']) { 61 script { 62 nix.develop(""" 63 ghp-import \ 64 -b ${deployBranch()} \ 65 -c ${deployDomain()} \ 66 -p docs/.vuepress/dist 67 """, pure: false) 68 } 69 } 70 } 71 } 72 } 73 74 post { 75 cleanup { cleanWs() } 76 } 77 } 78 79 def isMasterBranch() { GIT_BRANCH ==~ /.*master/ } 80 def deployBranch() { isMasterBranch() ? 'deploy-master' : 'deploy-develop' } 81 def deployDomain() { isMasterBranch() ? 'libs.nimbus.team' : 'dev-libs.nimbus.team' }