-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
72 lines (63 loc) · 1.47 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
stages:
- build
- deploy
variables:
RULES_CHANGES_PATH: "**/*"
.base-rules:
rules:
- if: $CI_COMMIT_BRANCH == "master"
when: always
- if: '$CI_PIPELINE_SOURCE == "push"'
when: never
- if: $CI_COMMIT_TAG
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
changes:
- $RULES_CHANGES_PATH
- when: manual
allow_failure: true
.web:
extends: .base-rules
variables:
RULES_CHANGES_PATH: "projects/web/**/*"
web-build:
image: node
stage: build
extends: .web
needs: []
before_script:
- whoami
- node -v;
- npm -v;
- npm i -g [email protected];
- pnpm -v
script:
- cd projects/web
- pnpm i;
# - pnpm build:web;
- pnpm --filter @pluto-music/web build2
- ls;
artifacts:
paths:
- projects/web/dist/
web-deploy:
image: ubuntu
stage: deploy
needs: ["web-build"]
only:
- master
- deploy
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY"
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan $SSH_SERVER >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- cd projects/web/
- tar -zcvf dist.tar.gz dist
- scp dist.tar.gz root@$SSH_SERVER:/srv/pluto-music_web/
- ssh -t root@$SSH_SERVER "cd /srv/pluto-music_web && tar -zxf dist.tar.gz; exit;"