-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
61 lines (56 loc) · 1.76 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
stages:
- build
- deploy
test server:
stage: build
image: microsoft/dotnet:latest
script:
- cd Server
- dotnet test Higgs.Server.Test
build server:
stage: build
image: microsoft/dotnet:latest
script:
- cd Server
- dotnet publish -c Release
artifacts:
paths:
- Server/Higgs.Server/bin/Release/netcoreapp2.1/publish/*.*
build web:
stage: build
image: node:8.12.0
script:
- cd Web
- node --version
- npm --version
- npm install --unsafe-perm -g --silent @angular/cli@^7.0.6
- npm install --unsafe-perm --silent
- ng build --prod
- git rev-parse --verify HEAD > dist/assets/revision.txt
artifacts:
paths:
- Web/dist
deploy production:
environment: production
stage: deploy
image: node:latest
only:
- master
variables:
GIT_STRATEGY: none
script:
- apt-get -qq update
- apt-get -qq -y install rsync
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- echo "$SSH_KEY_DEPLOY" > ~/.ssh/id_rsa
- chown 400 ~/.ssh/id_rsa
- ls -la
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- "ssh deploy@$PRODUCTION_IP 'mkdir -p /var/www/Higgs/Server'"
- rsync -az --force --delete --progress -e "ssh -p22" Server/Higgs.Server/bin/Release/netcoreapp2.1/publish/* deploy@$PRODUCTION_IP:/var/www/Higgs/Server
- "ssh deploy@$PRODUCTION_IP 'cp /var/www/Higgs/Configuration/appsettings.Production.json /var/www/Higgs/Server/.'"
- "ssh deploy@$PRODUCTION_IP 'sudo systemctl restart higgs.server.service'"
- rsync -az --force --delete --progress -e "ssh -p22" Web/dist/* deploy@$PRODUCTION_IP:/var/www/Higgs/Web/dist
- rm ~/.ssh/id_rsa