forked from mozilla/protocol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
37 lines (34 loc) · 952 Bytes
/
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
#!groovy
def buildSite(destination) {
stage ('build') {
try {
sh "bin/build.sh " + destination
} catch(err) {
sh "bin/slack-notify.sh --stage 'build " + env.BRANCH_NAME + "' --status failure"
throw err
}
}
}
def syncS3(String bucket) {
stage ('s3 sync') {
try {
sh "cd dist && aws s3 sync . s3://" + bucket + " --acl public-read --delete --profile protocol"
} catch(err) {
sh "bin/slack-notify.sh --stage 's3 sync " + env.BRANCH_NAME + "' --status failure"
throw err
}
sh "bin/slack-notify.sh --stage 's3 sync " + env.BRANCH_NAME + "' --status shipped"
}
}
node {
stage ('Prepare') {
checkout scm
}
if ( env.BRANCH_NAME == 'master' ) {
buildSite('stage')
syncS3('mozilla-protocol-stage')
} else if ( env.BRANCH_NAME == 'prod' ) {
buildSite('prod')
syncS3('mozilla-protocol')
}
}