-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathJenkinsfile
More file actions
30 lines (30 loc) · 842 Bytes
/
Jenkinsfile
File metadata and controls
30 lines (30 loc) · 842 Bytes
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
pipeline {
agent any
stages {
stage('Build') {
steps {
sh '''#!/usr/bin/bash
. ~/.rvm/scripts/rvm && bundle exec jekyll build
'''
}
}
stage('Deploy') {
steps {
sh '''#!/usr/bin/bash
set -e
arch=docs_${BUILD_TIMESTAMP}.tgz
tar -czf ${arch} --exclude-from=tar_exclude -C _site .
echo "Deploing to ${SERVER_NAME}..."
scp ${arch} ${SERVER_USER}@${SERVER_NAME}:/srv/www/docs-arch
ssh -T ${SERVER_USER}@${SERVER_NAME} << EOF
cd /srv/www/docs
rm -rf /srv/www/docs/*
tar xzf /srv/www/docs-arch/${arch}
find /srv/www/docs-arch/ -name "docs_*" -mtime +60 -exec rm {} \\;
EOF
rm ${arch}
'''
}
}
}
}