-
Notifications
You must be signed in to change notification settings - Fork 739
/
.gitlab-ci.yml
134 lines (127 loc) · 2.41 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
stages:
- build-dev
- review
- latest
- build-prod
- staging
- production
build-dev:
image: node:lts
stage: build-dev
cache:
key: build
paths:
- website/node_modules
script:
- cd website/
- yarn install --frozen-lockfile
- yarn build-dev
- cd ..
- ./scripts/inject-rev.sh out/index.html
artifacts:
expire_in: 1 days
paths:
- out
review:
stage: review
script:
- rsync -av out/ /data/astexplorer/website-new/$CI_BUILD_REF_SLUG
- rm -rf out/
variables:
GIT_STRATEGY: none
environment:
name: review/$CI_BUILD_REF_NAME
url: https://$CI_BUILD_REF_SLUG.astexplorer.net
on_stop: stop_review
only:
- branches
except:
- master
tags:
- astexplorer
stop_review:
stage: review
script:
- rm -rf public /data/astexplorer/website-new/$CI_BUILD_REF_SLUG
variables:
GIT_STRATEGY: none
when: manual
environment:
name: review/$CI_BUILD_REF_NAME
action: stop
only:
- branches
except:
- master
tags:
- astexplorer
latest:
stage: latest
script:
- rsync -rv --delete out/ /data/astexplorer/website-new/master/
- rm -rf out/
variables:
GIT_STRATEGY: none
environment:
name: master
url: http://master.astexplorer.net
only:
- master
tags:
- astexplorer
build-prod:
image: node:lts
stage: build-prod
dependencies: []
script:
- cd website/
- yarn install --frozen-lockfile
- yarn build
- cd ..
- ./scripts/inject-rev.sh out/index.html
cache:
key: build
paths:
- website/node_modules
when: manual
allow_failure: false
artifacts:
expire_in: 7 days
paths:
- out
staging:
stage: staging
dependencies:
- build-prod
variables:
GIT_STRATEGY: none
deploy_path: /data/astexplorer/website-new/staging/
script:
- ./scripts/check-conflicts.sh out/ $deploy_path
- rsync -rv out/ $deploy_path
- rm -rf out/
environment:
name: staging
url: http://staging.astexplorer.net
only:
- master
tags:
- astexplorer
production:
stage: production
dependencies:
- build-prod
variables:
deploy_path: /data/astexplorer/website-production/
script:
- ./scripts/check-conflicts.sh out/ $deploy_path
- rsync -rv out/ $deploy_path
- rm -rf out/
environment:
name: production
url: https://astexplorer.net/
when: manual
only:
- master
tags:
- astexplorer