-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
49 lines (44 loc) · 1.08 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
stages:
- lint
- prettier
- deploy
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- .npm/
.default-cache: &default-cache
before_script:
- npm ci --cache .npm --prefer-offline
eslint:
extends:
- .default-cache
image: node:16.13.1-alpine
stage: lint
script:
- npm install
- npm run lint
prettier:
extends:
- .default-cache
image: node:16.13.1-alpine
stage: lint
script:
- npm install
- npm run check:format
deploy:
image: ubuntu:latest
stage: deploy
script:
- apt -qq update && apt upgrade -qqy openssh-client rsync
- eval $(ssh-agent -s)
- echo "${SSH_PRIVATE_KEY}" | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "${SSH_KNOWN_HOSTS}" > ~/.ssh/known_hosts
- rsync -a --progress
--human-readable --delete
--exclude-from '.gitignore'
--exclude-from='.gitignore'
--exclude={'public/','\.[a-z]*','*.yml','*.md','*.png','docs/','test-support/'}
. deploy@$REMOTE_HOST:~/realworld/
- ssh deploy@$REMOTE_HOST "pushd ~/realworld && npm install && pm2 restart realworld && popd"