This repository has been archived by the owner on Jan 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
95 lines (86 loc) · 1.64 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
variables:
BUILD_DIR: dist
stages:
- codestyle
- test
- build
- review
- deploy
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
tslint:
stage: codestyle
tags:
- nodejs
allow_failure: false
dependencies: []
script:
- npm install
- node_modules/tslint/bin/tslint -p ./tsconfig.json -c ./tslint.json --project
unit_tests:
stage: test
tags:
- nodejs
allow_failure: false
dependencies: []
variables:
CHROME_BIN: /usr/bin/google-chrome
script:
- npm install
- npm test
ngbuild:
stage: build
tags:
- angular
allow_failure: false
dependencies: []
script:
- npm install -g @angular/cli
- npm install
- ng build --prod --aot
artifacts:
paths:
- "$BUILD_DIR"
#review:
# stage: review
# script:
# - rsync -av --delete "$BUILD_DIR" /srv/nginx/pages/$CI_BUILD_REF_SLUG
# environment:
# name: review/$CI_BUILD_REF_NAME
# url: http://$CI_BUILD_REF_SLUG.$SERVER_URL
# on_stop: stop_review
# only:
# - branches
# except:
# - master
# tags:
# - nginx
#stop_review:
# stage: review
# script:
# - rm -rf "$BUILD_DIR" /srv/nginx/pages/$CI_BUILD_REF_SLUG
# variables:
# GIT_STRATEGY: none
# when: manual
# environment:
# name: review/$CI_BUILD_REF_NAME
# action: stop
# tags:
# - nginx
deploy:
stage: deploy
only:
- master
tags:
- ssh
dependencies:
- tslint
- ngbuild
script:
- eval $(ssh-agent -s)
- mkdir ~/.ssh #&& echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- ssh-keyscan "$SERVER_URL" >> ~/.ssh/known_hosts
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- scp -r "$BUILD_DIR"* "$SSH_URL"