-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
75 lines (68 loc) · 1.87 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
stages:
- build
- publish
- deploy
include:
- project: 'lvckyworld-docker/gitlab-ci-rezept'
file:
- '/deployment/.rsync.yml'
- component: git.lvckyworld.dev/pipeline-components/node-package-manager/npm-install@~latest
- component: git.lvckyworld.dev/pipeline-components/node-package-manager/publish-npm-package@~latest
npm install:
extends: .npm install
script:
- ls -la
- npm run build
- npm run compodoc
only:
- merge_requests
- master
- /^(deploy-[a-z]{3,}-)\d{8}.\d{4}$/
cache:
paths:
- ./documentation/
- ./lib/
publish to npm:
extends: .publish to npm
only:
- /^(deploy-prod-)\d{8}.\d{4}$/
deploy documentation:
stage: deploy
extends: .deploy-rsync
needs:
- publish to npm
environment:
name: 'production'
url: https://docs.lvckyworld.net/marina-api-sdk
variables:
SERVER: 'gamma.lvckyworld.dev'
SERVER_PORT: 22
SERVER_USERNAME: 'root'
SERVER_PATH: '/var/www/vhosts/lvckyworld.net/docs.lvckyworld.net/marina-api-sdk'
RSYNC_OPTIONS: '--delete'
FOLDER_TO_SYNC: './documentation/'
before_script:
- ls -la ${FOLDER_TO_SYNC}
script:
# deploy using rsync jobs script
- !reference [ .deploy-rsync, script ]
- |
runssh() {
echo "$@" | ssh -p $SERVER_PORT $SERVER_USERNAME@$SERVER "(cd $SERVER_PATH || true && export CURRENTDIR=${CURRENTDIR} &&
export SERVER_PATH=${SERVER_PATH} && export CI_COMMIT_SHORT_SHA=${CI_COMMIT_SHORT_SHA} && bash -s)"
}
# list the files on the server
- echo "FILES FROM SERVER"
- runssh ls -la
# move to the correct directory
- mv documentation/* .
- rm -rf documentation
# correct ownership
- runssh plesk repair fs -y -v
cache:
key: ${CI_COMMIT_REF_SLUG}-${CI_PROJECT_ID}
paths:
- ./documentation
policy: pull
only:
- /^(deploy-prod-)\d{8}.\d{4}$/