-
Notifications
You must be signed in to change notification settings - Fork 14
/
Jenkinsfile
55 lines (45 loc) · 1.82 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
node {
checkout scm
stage('Prepare') {
sh 'cp -rf $HOME/build-cache/node_modules ./'
sh 'cp -rf $HOME/build-cache/profiles.clj ./'
}
stage('Migrate test') {
sh 'lein with-profile test migratus migrate'
}
stage('Test clj') {
sh 'lein test'
}
stage('Test cljs') {
sh 'npm install'
sh 'shadow-cljs compile ci'
sh 'karma start --single-run'
}
stage('Cache results') {
sh 'cp -rf ./node_modules $HOME/build-cache/'
}
if (env.BRANCH_NAME == 'master') {
stage('Build') {
sh 'lein clean'
sh "shadow-cljs release app --config-merge '{:release-version \"${currentBuild.id}\"}'"
sh 'cp -f ./resources/public/index.html.source ./resources/public/index.html'
sh "sed -i 's/\\/js\\/compiled\\/app.js/\\/js\\/compiled\\/app.${currentBuild.id}.js/' ./resources/public/index.html"
sh 'sass ./src/cljs/webchange/ui_framework/styles/index/:./resources/public/css/'
sh 'lein uberjar'
}
stage('Deploy') {
sh "scp ./target/webchange.jar deploy@stage-env:/srv/www/webchange/releases/${currentBuild.id}-webchange.jar"
sh "ssh deploy@stage-env 'ln -nsf /srv/www/webchange/releases/${currentBuild.id}-webchange.jar /srv/www/webchange/current.jar'"
sh "ssh deploy@stage-env 'sudo systemctl stop webchange.service'"
}
stage('Migrate') {
sh "ssh deploy@stage-env 'java -Dconfig=/srv/www/webchange/config.edn -jar /srv/www/webchange/current.jar migrate'"
}
stage('Update Templates') {
sh "ssh deploy@stage-env 'java -Dconfig=/srv/www/webchange/config.edn -jar /srv/www/webchange/current.jar update-templates'"
}
stage('Restart') {
sh "ssh deploy@stage-env 'sudo systemctl start webchange.service'"
}
}
}