forked from pimcore/pimcore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
59 lines (54 loc) · 1.77 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
stages:
- build
- deploy
build-docs:
image: tetraweb/php:7.1
stage: build
when: always
cache:
key: "$CI_BUILD_REF_NAME"
paths:
- ~/.composer/cache
- tmp-docs/pimcore-docs/vendor
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
expire_in: 1 week
paths:
- documentation
before_script:
- docker-php-ext-enable zip opcache
script:
- .ci/setup-docs.sh
- .ci/run-docs.sh
# move to root as we don't want to have subdirectories in build artifact
- rm -rf documentation && mv tmp-docs/pimcore-docs/build/static documentation
deploy-docs:
image: debian:stable
stage: deploy
when: always
environment:
name: docs/${CI_COMMIT_REF_NAME}
url: ${DOCS_DEPLOY_BASE_URL}/${CI_COMMIT_REF_NAME}
only:
- master
- pimcore4
before_script:
# test that all env vars are set properly
- '[ ! -z "$SSH_PRIVATE_KEY" ]'
- '[ ! -z "$SSH_SERVER_HOSTKEYS" ]'
# install needed packages
- '( apt-get update -y && apt-get install openssh-client rsync -y )'
# See https://docs.gitlab.com/ce/ci/ssh_keys/README.html
# to get SSH host keys execute ssh-keyscan <hostname>
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo "$SSH_SERVER_HOSTKEYS" > ~/.ssh/known_hosts && chmod 0644 ~/.ssh/known_hosts'
script:
# test that all env vars are set properly
- '[ ! -z "$DOCS_DEPLOY_USER" ]'
- '[ ! -z "$DOCS_DEPLOY_HOST" ]'
- '[ ! -z "$DOCS_DEPLOY_PATH" ]'
- export DOCS_DEPLOY_FULL_PATH=${DOCS_DEPLOY_PATH}/${CI_COMMIT_REF_NAME}
- ssh ${DOCS_DEPLOY_USER}@${DOCS_DEPLOY_HOST} "mkdir -p ${DOCS_DEPLOY_FULL_PATH}"
- rsync -avz --delete documentation/ ${DOCS_DEPLOY_USER}@${DOCS_DEPLOY_HOST}:${DOCS_DEPLOY_FULL_PATH}/