-
Notifications
You must be signed in to change notification settings - Fork 42
/
.gitlab-ci.yml
75 lines (70 loc) · 1.66 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
image: node:latest
stages:
- test
- deploy
- release
"Test":
stage: test
allow_failure: false
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .npm/
before_script:
- npm ci
script:
- npm run tsc
pages:
stage: deploy
allow_failure: false
before_script:
- |-
if [[ ! -z ${GIT_LAB_USERNAME+x} ]]; then
git config --global user.email "bot@_.com"
git config --global user.name "Auto Bot"
git clone http://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/codogo-b/back-home-safe.git &> /dev/null
git checkout -qf master
cd back-home-safe
fi
- npm ci
only:
- master
environment:
name: production
artifacts:
paths:
- public
script:
- |-
if [[ -z ${GIT_LAB_USERNAME+x} ]]; then
npm run build
rm -rf ./public
mv ./dist ./public
else
npm run release
npm run build
rm -rf ../public
mv ./dist ../public
cd ../
fi
release:
stage: release
allow_failure: false
only:
refs:
- master
variables:
- $GIT_LAB_USERNAME != null
- $PERSONAL_ACCESS_TOKEN != null
before_script:
- git config --global user.email "bot@_.com"
- git config --global user.name "Auto Bot"
- git clone http://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/codogo-b/back-home-safe.git &> /dev/null
- git checkout -qf master
- cd back-home-safe
- npm ci
environment:
name: production
script:
- npm run release
- git push http://${GIT_LAB_USERNAME}:${PERSONAL_ACCESS_TOKEN}@gitlab.com/codogo-b/back-home-safe.git --verbose --no-verify --follow-tags HEAD:master