forked from csev/py4e
-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Jenkinsfile
81 lines (81 loc) · 2.9 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
pipeline {
agent {
dockerfile true
}
stages {
stage('Clean workspace') {
steps {
sh 'rm -rf dest'
sh 'cp -r app dest'
}
}
stage('Prepare book') {
steps {
sh 'cd dest && bash prep.sh'
}
}
stage('Prepare website') {
steps {
sh '''cd dest
git clone https://github.com/oupala/apaxy.git
cp .htaccess .htaccess.orig
cd apaxy
./apaxy-configure.sh -d ..
cd ..
cat .htaccess >> .htaccess.orig
mv .htaccess.orig .htaccess
sed -i -e 's/Options +Indexes/#Options +Indexes/g' .htaccess
sed -i -e 's/Options -Indexes/#Options -Indexes/g' theme/.htaccess
'''
sh '''cd dest
git clone https://github.com/andre-wojtowicz/tsugi.git
'''
sh '''cd dest/mod
git clone https://github.com/tsugitools/gift.git
git clone https://github.com/tsugitools/peer-grade.git
cd ../mod_translation
cd peer-grade
bash change.sh
cd ../gift
bash change.sh
'''
sh '''cd dest
sed -i -e "s/__LAST_UPDATE__/$(date '+%Y-%m-%d')/g" book.php
'''
}
}
stage('Publish') {
steps {
sshPublisher(
continueOnError: false,
failOnError: true,
publishers: [
sshPublisherDesc(
configName: "andre-py4epl",
transfers: [
sshTransfer(
execCommand: 'shopt -s dotglob && rm -rf ~/public_html/*'
),
sshTransfer(
remoteDirectory: 'public_html',
sourceFiles: 'dest/',
removePrefix: 'dest'
),
sshTransfer(
execCommand: 'bash customize.sh'
),
sshTransfer(
execCommand: 'find public_html -type d -print0 | xargs -0 chmod 755'
),
sshTransfer(
execCommand: 'find public_html -type f -print0 | xargs -0 chmod 644'
)
],
verbose: true
)
]
)
}
}
}
}