-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
72 lines (67 loc) · 1.79 KB
/
.gitlab-ci.yml
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
image: node:14
stages:
- build
- deploy_staging
- deploy_master
cache:
untracked: true
key: '$CI_PROJECT_ID'
paths:
- node_modules/
- _site/vendor/
- .bundled/
- .yarn
build:
stage: build
script:
- ls -l
- yarn config set cache-folder .yarn
- yarn install
- yarn generate
- echo "BUILD SUCCESSFULLY"
artifacts:
paths:
- dist/
expire_in: 20 mins
# environment:
# name: development
# only:
# - develop
deploy_staging:
stage: deploy_staging
image: python:3.5
dependencies:
- build
script:
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
- export S3_BUCKET_NAME=$S3_BUCKET_NAME_STAGING
- export DISTRIBUTION_ID=$DISTRIBUTION_ID
- pip install awscli --upgrade --user
- export PATH=~/.local/bin:$PATH
- aws s3 sync --acl public-read --delete dist $S3_BUCKET_NAME_STAGING
#- aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths '/*'
- echo "DEPLOYED SUCCESSFULLY TO STAGING"
environment:
name: development
only:
- develop
deploy_master:
stage: deploy_master
image: python:3.5
dependencies:
- build
script:
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY
- export S3_BUCKET_NAME=$S3_BUCKET_NAME_PRODUCTION
- export DISTRIBUTION_ID=$DISTRIBUTION_ID
- pip install awscli --upgrade --user
- export PATH=~/.local/bin:$PATH
- aws s3 sync --acl public-read --cache-control "max-age=2592000, public" --delete dist $S3_BUCKET_NAME_PRODUCTION
- aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths '/*'
- echo "DEPLOYED SUCCESSFULLY TO PRODUCTION"
environment:
name: production
only:
- master