-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathJenkinsfile
47 lines (44 loc) · 1.36 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
pipeline {
agent {
label 'main'
}
stages {
stage('Verify Enviornment') {
steps {
script {
if (!env.SERVER_DEPLOY_DIRECTORY || env.SERVER_DEPLOY_DIRECTORY == '') {
error('Missing SERVER_DEPLOY_DIRECTORY')
}
}
sh 'printenv'
}
}
stage('Build') {
// do the actual build
steps {
nodejs(nodeJSInstallationName: 'Node 14') {
sh 'npm install'
sh 'npm run generate'
}
// stash the data
dir('dist') {
stash name: "website", includes: "**/*"
}
}
}
stage('Deploy') {
agent {
label 'vchlearn'
}
options { skipDefaultCheckout() }
steps {
dir("/home/vchlearn/${SERVER_DEPLOY_DIRECTORY}") {
// Remove all previous deploy files
sh """find /home/vchlearn/${SERVER_DEPLOY_DIRECTORY} -maxdepth 1 -mindepth 1 -not -name "cgi-bin" -not -name ".htaccess" -not -name ".well-known" -exec rm -rf {} +"""
// Redeploy
unstash "website"
}
}
}
}
}