-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
55 lines (47 loc) · 1.18 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("${env.NODE}") {
currentBuild.result = "SUCCESS"
try {
stage('Clean up') {
deleteDir()
}
stage('Checkout') {
checkout scm
}
stage('D/L dependencies') {
sh 'gem install bundler'
sh 'bundle'
}
stage('Test') {
sh 'rake test:production'
}
stage('Build production') {
sh 'rake build:production'
}
stage('Deploy') {
def files = findFiles(glob: '_site/**/*')
files.each {
def file = it
def dst = file.path.replace('_site/', '')
println "file: ${file}"
println "name: ${file.name}"
println "path: ${file.path}"
println "dst: ${dst}"
withAWS(region:"${env.REGION}",credentials:"${env.CREDENTIAL}") {
s3Upload(
bucket: "${env.HOST}",
file: "${file.path}",
path: "${dst}",
)
}
}
}
stage('Invalidate Cloudfront') {
withAWS(region:"${env.REGION}",credentials:"${env.CREDENTIAL}") {
cfInvalidate(distribution: "${env.CF_DIST_ID}", paths: ['/*'])
}
}
} catch (err) {
currentBuild.result = 'FAILURE'
throw err
}
}