-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy path.gitlab-ci.yml
55 lines (49 loc) · 1.22 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
image: docker:latest
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event" || $CI_PIPELINE_SOURCE == "push"'
when: never
- when: always
stages:
- build
- deploy
variables:
ENVIRONMENT: ''
CI: ''
cache:
paths:
- node_modules/
- .yarn
build:
stage: build
image: node:16
before_script:
- yarn config set cache-folder .yarn
- rm -rf node_modules && yarn install --frozen-lockfile
script:
- mkdir ~/src_maps
- yarn $ENVIRONMENT-build
artifacts:
paths:
- build/
expire_in: 1 hour
rules:
- if: '$ENVIRONMENT == "production" || $ENVIRONMENT == "staging" || $ENVIRONMENT == "testnet"'
when: always
allow_failure: false
- when: never
deploy:
stage: deploy
before_script:
- apk add --no-cache curl jq python3 py-pip
- pip3 install awscli
script:
- aws s3 cp build/ s3://$S3_BUCKET_NAME/ --recursive --include "*"
- aws cloudfront create-invalidation --distribution-id $CDN_DISTRIBUTION_ID --paths "/index.html"
environment:
name: $ENVIRONMENT
rules:
- if: '$ENVIRONMENT == "production" || $ENVIRONMENT == "staging" || $ENVIRONMENT == "testnet"'
when: always
allow_failure: false
- when: never