diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9a448589352554667fb3e3f817e9ce32dc2c03ea..07445822947b376b68d697587935a84d5bb801d1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -125,3 +125,48 @@ deploy to production: only: - master@sccs/docs.it4i.cz when: manual + +deploy to stage on docs_devel: + environment: stage + stage: deploy + image: it4innovations/docker-mkdocscheck:latest + before_script: + # install ssh-agent + - '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 + - eval $(ssh-agent -s) + # add ssh key stored in SSH_PRIVATE_KEY variable to the agent store + - ssh-add <(echo "$SSH_PRIVATE_KEY_DEV") + # disable host key checking (NOTE: makes you susceptible to man-in-the-middle attacks) + # WARNING: use only in docker container, if you use it with shell you will overwrite your user's ssh config + - mkdir -p ~/.ssh + - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config + script: + - chown nginx:nginx site -R + - rsync -a --delete site/ root@"$SSH_HOST_STAGE_DEV":/srv/docs-devel.it4i.cz/devel/$CI_BUILD_REF_NAME/ + only: + - branches@sccs/docs.it4i.cz + +deploy to production on docs_devel: + environment: master + stage: deploy + image: it4innovations/docker-mkdocscheck:latest + before_script: + # install ssh-agent + - '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 + - eval $(ssh-agent -s) + # add ssh key stored in SSH_PRIVATE_KEY variable to the agent store + - ssh-add <(echo "$SSH_PRIVATE_KEY_DEV") + # disable host key checking (NOTE: makes you susceptible to man-in-the-middle attacks) + # WARNING: use only in docker container, if you use it with shell you will overwrite your user's ssh config + - mkdir -p ~/.ssh + - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config + script: + - chown nginx:nginx site -R + - rsync -a --delete site/ root@"$SSH_HOST_STAGE_DEV":/srv/docs.it4i.cz/site/ + only: + - master@sccs/docs.it4i.cz + when: manual