-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathJenkinsfile_frontend
More file actions
50 lines (45 loc) · 1.47 KB
/
Jenkinsfile_frontend
File metadata and controls
50 lines (45 loc) · 1.47 KB
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
// ######################################
//
// Jenkinsfile_frontend
// NEWSPACE-MSA 프론트엔드 파이프라인
//
// ######################################
pipeline {
agent any
environment {
AWS_REGION = "us-east-1"
S3_BUCKET = "mini-project-9-frontend"
}
stages {
stage('git clone') {
steps {
git branch: 'main', url: 'https://github.com/newspace-msa/newspace-frontend.git'
}
}
stage('install & build') {
steps {
dir("./newspace-frontend") {
sh 'npm ci'
sh 'npm run build'
}
}
}
stage('Deploy to S3 without withAWS') {
steps {
withCredentials([
string(credentialsId: 'aws-access-key', variable: 'AWS_ACCESS_KEY_ID'),
string(credentialsId: 'aws-secret-key', variable: 'AWS_SECRET_ACCESS_KEY'),
string(credentialsId: 'aws-cloudfront-dist-id', variable: 'CLOUDFRONT_DIST_ID')
]) {
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 newspace-frontend/dist/ s3://$S3_BUCKET --delete
aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DIST_ID --paths /index.html
'''
}
}
}
}
}