-
Notifications
You must be signed in to change notification settings - Fork 9
/
Jenkinsfile
79 lines (71 loc) · 1.71 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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 'npm install --silent'
/* TODO: Build the main page. */
sh 'mkdir -p build/docs'
sh 'cp index.html build/docs/'
}
}
stage('Examples') {
parallel {
stage('eth-pm') { steps { script { buildExample() } } }
stage('store-reactjs-chat') { steps { script { buildExample() } } }
}
}
stage('HTML Examples') {
parallel {
stage('store-js') { steps { script { copyExample() } } }
stage('light-chat') { steps { script { copyExample() } } }
}
}
stage('Publish') {
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("examples/${example}") {
sh 'npm install --silent'
sh 'npm run build'
sh "mkdir -p ${dest}"
sh "cp -r build/. ${dest}"
}
}
def copyExample(example=STAGE_NAME) {
def source = "examples/${example}"
def dest = "build/docs/${example}"
sh "mkdir -p ${dest}"
sh "cp -r ${source}/. ${dest}"
}