-
Notifications
You must be signed in to change notification settings - Fork 123
/
Copy pathJenkinsfile
66 lines (61 loc) · 2.57 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
pipeline {
agent any
stages {
stage('Clean') {
steps {
sh 'rm -rf _site'
}
}
stage('Build staging') {
when {
not {
branch 'master'
}
}
steps {
script {
docker.image('jekyll/jekyll').inside('-v="$PWD:/srv/jekyll" -v="$HOME/.katalon_docs_bundle:/usr/local/bundle"') {
sh "mkdir -p _site/${env.BRANCH_NAME}"
sh 'bundle install'
sh 'bundle exec jekyll clean'
sh "bundle exec jekyll build --baseurl /${env.BRANCH_NAME} --destination _site/${env.BRANCH_NAME}"
}
withAWS(region: 'us-east-1', credentials: 'aws-docs-staging') {
s3Upload(file:'_site', bucket:'docs-staging.katalon.com', path:'', acl:'PublicRead')
}
docker.image('jekyll/jekyll').inside('-v="$PWD:/srv/jekyll" -v="$HOME/.katalon_docs_bundle:/usr/local/bundle"') {
sh 'bundle install'
sh 'bundle exec jekyll clean'
}
}
}
}
stage('Build production') {
when { branch 'master' }
environment {
ALGOLIA_API_KEY = credentials('algolia-api-key')
}
steps {
script {
docker.image('jekyll/jekyll').inside('-v="$PWD:/srv/jekyll" -v="$HOME/.katalon_docs_bundle:/usr/local/bundle"') {
sh 'bundle install'
sh 'bundle exec jekyll clean'
sh 'bundle exec jekyll build'
sh 'rm -rfv _site/robots.txt'
}
withAWS(region: 'us-east-1', credentials: 'aws-docs-staging') {
s3Upload(file:'_site', bucket:'docs.katalon.com', path:'', acl:'PublicRead')
}
withAWS(region: 'us-east-1', credentials: 'aws-docs-staging') {
cfInvalidate(distribution:'E39AGUOIPSZ2OA', paths:['/*'])
}
docker.image('jekyll/jekyll').inside('-v="$PWD:/srv/jekyll" -v="$HOME/.katalon_docs_bundle:/usr/local/bundle"') {
sh 'bundle install'
sh 'bundle exec jekyll clean'
sh 'bundle exec jekyll algolia --verbose'
}
}
}
}
}
}