This repository has been archived by the owner on Sep 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy path.gitlab-ci.yml
95 lines (86 loc) · 2.23 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
image: node:10.16
stages:
- prepare
- test
- build
- deploy
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
- .yarn/
prepare:
stage: prepare
script:
- npm install yarn --no-progress --global
- yarn add now --cache-folder .yarn
- yarn install --cache-folder .yarn
only:
- master
- develop
test:
stage: test
script:
- echo "Running unit tests"
# - npm run test
only:
- master
- develop
build development:
stage: build
script:
- echo "Building project for development environment at $DEPLOYMENT_URL_DEVELOPMENT"
- PUBLIC_URL=$DEPLOYMENT_URL_DEVELOPMENT yarn build
only:
- develop
artifacts:
name: "artifacts-$CI_JOB_ID-$CI_COMMIT_SHORT_SHA"
paths:
- build
build:
stage: build
script:
- echo "Building project for staging environment at $DEPLOYMENT_URL_STAGING"
- DEPLOY_ENV=staging PUBLIC_URL=$DEPLOYMENT_URL_STAGING yarn build && mv build build-staging
- echo "Building project for production environment at $DEPLOYMENT_URL_PRODUCTION"
- DEPLOY_ENV=production PUBLIC_URL=$DEPLOYMENT_URL_PRODUCTION GENERATE_SOURCEMAP=false yarn build && mv build build-production
only:
- master
artifacts:
name: "artifacts-$CI_JOB_ID-$CI_COMMIT_SHORT_SHA"
paths:
- build-staging
- build-production
deploy to development:
stage: deploy
environment:
name: development
url: $DEPLOYMENT_URL_DEVELOPMENT
script:
- echo "Deploying to development at $DEPLOYMENT_URL_DEVELOPMENT"
- node_modules/.bin/now ./build --token $NOW_TOKEN -A ../now.gitlab.json
- node_modules/.bin/now alias --token $NOW_TOKEN $DEPLOYMENT_URL_DEVELOPMENT
only:
- develop
deploy to staging:
stage: deploy
environment:
name: staging
url: $DEPLOYMENT_URL_STAGING
script:
- echo "Deploying to staging at $DEPLOYMENT_URL_STAGING"
- DEPLOY_ENV=staging node_modules/.bin/gulp deploy-aws
only:
- master
deploy to production:
stage: deploy
environment:
name: production
url: $DEPLOYMENT_URL_PRODUCTION
script:
- echo "Deploying to production at $DEPLOYMENT_URL_PRODUCTION"
- DEPLOY_ENV=production node_modules/.bin/gulp deploy-aws
when: manual
allow_failure: false
only:
- master