-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
84 lines (75 loc) · 2.61 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
image: node:12-buster
# See https://angular.io/guide/testing#configure-project-for-gitlab-ci
variables:
FF_USE_FASTZIP: "true"
cache:
untracked: true
policy: push
key: ${CI_COMMIT_SHORT_SHA}
paths:
- frontend/monastic-matrix/node_modules/
.pull_cached_node_modules:
cache:
untracked: true
key: ${CI_COMMIT_SHORT_SHA}
policy: pull
stages:
- build
- deploy-dev
# - deploy-prod
build:
stage: build
extends: .pull_cached_node_modules
before_script:
- npm install -g @angular/cli
- cp src/environments/environment.ts.template src/environments/environment.ts
- cp src/environments/environment.prod.ts.template src/environments/environment.prod.ts
script:
- npm install
- ng build --configuration=production --base-href /$URL_PATH/ --baseHref /$URL_PATH/
after_script:
- tar czf pure-external-orgs.tar.gz ./dist/*
artifacts:
paths:
- pure-external-orgs.tar.gz
.ssh_setup:
before_script:
- apt-get update -qq
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
.ssh_finish_config:
before_script:
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
deploy-dev:
stage: deploy-dev
extends: .pull_cached_node_modules
before_script:
- !reference [build, before_script]
- !reference [.ssh_setup, before_script]
- echo "$DEV_SSH_KEY" | tr -d '\r' | ssh-add -
- !reference [.ssh_finish_config, before_script]
script:
- sed -i "s|PURE_TEST_URL|$DEV_PURE_TEST_URL|" src/environments/environment*ts
- sed -i "s|PURE_TEST_PROXY_URL|$DEV_PURE_TEST_PROXY_URL|" src/environments/environment*ts
- sed -i "s|PURE_LIVE_URL|$DEV_PURE_LIVE_URL|" src/environments/environment*ts
- sed -i "s|PURE_LIVE_PROXY_URL|$DEV_PURE_LIVE_PROXY_URL|" src/environments/environment*ts
- !reference [build, script]
- ssh -o stricthostkeychecking=no $DEV_USER@$DEV_SERVER "rm -fr $DEV_SERVER_PATH/*"
- scp -o stricthostkeychecking=no -r ./dist/pure-external-orgs/* $DEV_USER@$DEV_SERVER:~/pure-external-orgs
only:
- main
# deploy-prod:
# stage: deploy-prod
# extends: .pull_cached_node_modules
# before_script:
# - !reference [build, before_script]
# - !reference [.ssh_setup, before_script]
# - echo "$PROD_SSH_KEY" | tr -d '\r' | ssh-add -
# - !reference [.ssh_finish_config, before_script]
# script:
# - !reference [build, script]
# - ssh -o stricthostkeychecking=no $PROD_USER@$PROD_SERVER "rm -r $PROD_SERVER_PATH/*"
# - scp -o stricthostkeychecking=no -r ./dist/pure-external-orgs/* $PROD_USER@$PROD_SERVER:$PROD_SERVER_PATH
# only:
# - tags