js-waku-examples/ci/Jenkinsfile

85 lines
2.2 KiB
Plaintext
Raw Normal View History

pipeline {
agent {
dockerfile {
label 'linux'
dir 'ci'
}
}
options {
disableConcurrentBuilds()
/* manage how many builds we keep */
buildDiscarder(logRotator(
numToKeepStr: '20',
daysToKeepStr: '30',
))
}
environment {
SITE_DOMAIN = 'examples.waku.org'
GIT_AUTHOR_NAME = 'status-im-auto'
GIT_AUTHOR_EMAIL = 'auto@status.im'
GIT_SSH_COMMAND = 'ssh -o StrictHostKeyChecking=no'
PUPPETEER_SKIP_DOWNLOAD = 'true'
}
stages {
stage('Pre') {
steps {
sh 'pnpm install --silent'
/* TODO: Build the main page. */
sh 'mkdir -p build/docs'
}
}
stage('Examples') {
parallel {
stage('eth-pm') { steps { script { buildExample() } } }
stage('relay-angular-chat') { steps { script { buildExample() } } }
stage('relay-reactjs-chat') { steps { script { buildExample() } } }
stage('rln-react-ts') { steps { script { buildExample() } } }
stage('store-reactjs-chat') { steps { script { buildExample() } } }
stage('web-chat') { steps { script { buildExample() } } }
}
}
stage('HTML Examples') {
parallel {
stage('relay-js') { steps { script { copyExample() } } }
stage('store-js') { steps { script { copyExample() } } }
stage('light-js') { steps { script { copyExample() } } }
2022-09-26 03:56:02 +00:00
stage('rln-js') { steps { script { copyExample() } } }
}
}
stage('Publish') {
//when { expression { GIT_BRANCH.endsWith('master') } }
steps { script {
sh "echo ${SITE_DOMAIN} > build/docs/CNAME"
sshagent(credentials: ['status-im-auto-ssh']) {
sh 'node ci/deploy.js'
}
} }
}
}
post {
always { cleanWs() }
}
}
def buildExample(example=STAGE_NAME) {
def dest = "${WORKSPACE}/build/docs/${example}"
dir("${example}") {
sh 'pnpm install --silent'
sh 'pnpm run build'
sh "mkdir -p ${dest}"
sh "cp -r build/. ${dest}"
}
}
def copyExample(example=STAGE_NAME) {
sh "mkdir -p build/docs/${example}"
sh "cp ${example}/index.html build/docs/${example}/"
2022-10-07 00:41:59 +00:00
sh "[ -f ${example}/style.css ] && cp ${example}/style.css build/docs/${example}/ || exit 0"
}