logos.co/Jenkinsfile

64 lines
1.2 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env groovy
library 'status-jenkins-lib@v1.8.8'
2023-06-01 20:22:28 +00:00
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 {
script {
nix.develop('yarn install')
}
2023-06-01 20:22:28 +00:00
}
}
stage('Build') {
steps {
script {
nix.develop('yarn build')
jenkins.genBuildMetaJSON('build/build.json')
2023-06-01 20:22:28 +00:00
}
}
}
stage('Publish') {
2023-06-01 20:22:28 +00:00
steps {
sshagent(credentials: ['status-im-auto-ssh']) {
script {
nix.develop("""
ghp-import \
-b ${deployBranch()} \
-c ${deployDomain()} \
-p build
"""
)
}
}
2023-06-01 20:22:28 +00:00
}
}
}
post {
cleanup { cleanWs() }
}
}
def isMasterBranch() { GIT_BRANCH ==~ /.*master/ }
def deployBranch() { isMasterBranch() ? 'deploy-master' : 'deploy-develop' }
def deployDomain() { isMasterBranch() ? 'logos.co' : 'dev.logos.co' }