-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
41 lines (37 loc) · 1.24 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
default:
image: node:latest
before_script:
- npm ci --cache .npm --prefer-offline
- |
{
echo "@${CI_PROJECT_ROOT_NAMESPACE}:registry=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/npm/"
echo "${CI_API_V4_URL#https?}/projects/${CI_PROJECT_ID}/packages/npm/:_authToken=\${CI_JOB_TOKEN}"
} | tee -a .npmrc
- export NODE_OPTIONS=--openssl-legacy-provider
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- .npm/
stages:
- build
- deploy
build:
stage: build
script: npm run docs:build
artifacts:
paths:
- ./builds/docs
deploy:
stage: deploy
dependencies:
- build
script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- 'which rsync || ( apt-get update -y && apt-get install rsync -y )'
# Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
# Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
- ssh-add <(echo "$SSH_PRIVATE_KEY_B64" | base64 --decode)
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- rsync -aiPh --chmod=ug=rwX,o=rX --delete builds/docs/ [email protected]:/var/www/html/docs/