-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
31 lines (31 loc) · 923 Bytes
/
Jenkinsfile
File metadata and controls
31 lines (31 loc) · 923 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
31
pipeline {
agent any
environment {
AWS_REGION = 'us-east-1' // change
S3_BUCKET = 'my-sample-ci-bucket' // change
}
stages {
stage('Checkout') {
steps { checkout scm }
}
stage('Build') {
steps {
sh 'npm install || true'
sh 'npm run build'
}
}
stage('Deploy to S3') {
steps {
// Bind Jenkins creds (Username/password style username=AKIA..., password=secret)
withCredentials([usernamePassword(credentialsId: 'aws-creds-id', usernameVariable: 'AWS_ACCESS_KEY_ID', passwordVariable: 'AWS_SECRET_ACCESS_KEY')]) {
sh '''
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
aws configure set default.region ${AWS_REGION}
aws s3 sync dist/ s3://${S3_BUCKET} --delete
'''
}
}
}
}
}