-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
45 lines (39 loc) · 986 Bytes
/
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
node {
def app
def project_name = 'msm'
stage('Clone repo'){
checkout scm
}
stage('Init Submodule'){
sh "git submodule init"
sh "git submodule update"
sh "cd $WORKSPACE/dist && git submodule init && git submodule update"
}
stage('Build'){
echo 'Cleaning old files.'
sh "rm -rf .git"
sh "ls -lah"
sh "yarn"
sh "yarn run build"
echo 'Packing files.'
sh "cd ./dist && zip -r package.zip ."
}
stage('Push to Remote Server'){
echo 'Connecting to the server.'
sh "scp -r -P 2047 $WORKSPACE/dist/package.zip www@srv1.limeishu.org.tw:/home/www/webserver/lms-extra/msm"
}
stage('Active Service'){
echo 'Connecting to the server.'
sh "ssh www@srv1.limeishu.org.tw -p 2047 '\
cd /home/www/webserver/lms-extra/msm; \
unzip -o package.zip; \
ls -lah; \
rm package.zip; \
ls -lah; \
'"
}
stage('Clean'){
echo 'Cleaning old files.'
sh "rm -rf $WORKSPACE/dist/package.zip"
}
}