-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
50 lines (47 loc) · 1.4 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
pipeline {
agent {
dockerfile {
filename 'Dockerfile.build'
}
}
environment {
AWS_ACCESS_KEY_ID = credentials("jenkins-aws-secret-key-id")
AWS_SECRET_ACCESS_KEY = credentials("jenkins-aws-secret-access-key")
PRODUCTION_S3_BUCKETNAME = "app.telephone-ro.se"
}
stages {
stage("Build") {
steps {
sh "npm ci"
sh "npm run build"
}
}
stage("Deploy production") {
when { branch "master" }
steps {
sh "aws s3 sync build s3://${PRODUCTION_S3_BUCKETNAME} --delete --acl public-read --cache-control max-age=31536000,public"
sh "aws s3 cp s3://${PRODUCTION_S3_BUCKETNAME}/index.html s3://${PRODUCTION_S3_BUCKETNAME}/index.html --metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/html --acl public-read"
}
}
}
post {
always {
echo 'One way or another, I have finished'
deleteDir() /* clean up our workspace */
}
success {
echo 'I succeeeded!'
slackSend color: 'good', message: "The pipeline ${currentBuild.fullDisplayName} completed successfully."
}
unstable {
echo 'I am unstable :/'
}
failure {
echo 'I failed :('
slackSend color: 'bad', message: "The pipeline ${currentBuild.fullDisplayName} failed."
}
changed {
echo 'Things were different before...'
}
}
}