forked from waves-exchange/neutrino-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
executable file
·37 lines (32 loc) · 977 Bytes
/
.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
stages:
- build
- deploy
variables:
DEV_DEPLOY_DIR: '/var/host/www/$CI_PROJECT_NAMESPACE-$CI_PROJECT_NAME/www-$CI_COMMIT_REF_NAME'
VENDOR_DIRS: 'node_modules'
EXCLUDE_DIRS: '.git .idea'
before_script:
- for DIR in $VENDOR_DIRS; do mkdir -p ../$DIR-$CI_PROJECT_NAME && rm -rf $DIR && mv ../$DIR-$CI_PROJECT_NAME ./$DIR; done
after_script:
- for DIR in $VENDOR_DIRS; do mv $DIR/ ../$DIR-$CI_PROJECT_NAME; done
build:
stage: build
only:
- master
artifacts:
paths:
- dist/
- .env
script:
- yarn
- cp -f .env.dev .env
- node webpack production
- echo "$CI_COMMIT_REF_NAME-$CI_JOB_ID" > $CI_PROJECT_DIR/dist/version.txt
deploy_dev:
stage: deploy
only:
- master
script:
- ssh root@dev "mkdir -p $DEV_DEPLOY_DIR"
- printf "%s\n" $EXCLUDE_DIRS > ../.rsync-exclude && rsync -rzak --exclude-from=../.rsync-exclude $CI_PROJECT_DIR/ root@dev:$DEV_DEPLOY_DIR
- ssh root@dev "sudo forever restart neutrino"