forked from darkobodnaruk/docs.status.im
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
91 lines (82 loc) · 2.11 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
80
81
82
83
84
85
86
87
88
89
90
91
pipeline {
agent { label 'linux' }
options {
disableConcurrentBuilds()
/* manage how many builds we keep */
buildDiscarder(logRotator(
numToKeepStr: '20',
daysToKeepStr: '30',
))
}
environment {
SCP_OPTS = 'StrictHostKeyChecking=no'
DEV_HOST = 'jenkins@node-01.do-ams3.proxy.misc.statusim.net'
DEV_SITE = 'dev.status.im'
GIT_USER = 'status-im-auto'
GIT_MAIL = 'auto@status.im'
}
stages {
stage('Git Prep') {
steps {
sh "git config user.name ${GIT_USER}"
sh "git config user.email ${GIT_MAIL}"
/* necessary to have access to the theme partials */
sshagent(credentials: ['status-im-auto-ssh']) {
sh 'git submodule update --init --recursive'
}
}
}
stage('Install Deps') {
steps {
sh 'yarn install'
}
}
stage('Index') {
steps {
withCredentials([usernamePassword(
credentialsId: 'search.status.im-auth',
usernameVariable: 'HEXO_ES_USER',
passwordVariable: 'HEXO_ES_PASS'
)]) {
sh 'yarn run index'
}
}
}
stage('Build') {
steps {
sh 'yarn run clean'
sh 'yarn run build'
}
}
stage('Robot') {
when { expression { !GIT_BRANCH.endsWith('master') } }
steps { script {
sh 'echo "Disallow: /" >> public/robots.txt'
} }
}
stage('Publish Prod') {
when { expression { GIT_BRANCH.endsWith('master') } }
steps { script {
sshagent(credentials: ['status-im-auto-ssh']) {
sh 'yarn run deploy'
}
} }
}
stage('Publish Devel') {
when { expression { !GIT_BRANCH.endsWith('master') } }
steps { script {
def site = DEV_SITE
/* dev site for testing translations */
if (GIT_BRANCH.endsWith('dev-lang')) {
site = 'dev-lang.status.im'
}
sshagent(credentials: ['jenkins-ssh']) {
sh """
rsync -e 'ssh -o ${SCP_OPTS}' -r --delete \
public/. ${DEV_HOST}:/var/www/${site}/
"""
}
} }
}
}
}