Skip to content
Snippets Groups Projects
Commit 0ec13bf0 authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files

feat: deploy to staticpages vm

parent 0e12b18c
No related branches found
No related tags found
No related merge requests found
......@@ -48,3 +48,25 @@ pages:
expire_in: 1 week
paths:
- public
## Deploys the website to a separate VM
Deploy to production:
stage: deploy
image: alpine:3.1
before_script:
- 'which ssh-agent || ( apk add --update openssh )'
- eval $(ssh-agent -s)
- echo "$B64SSHPRIVKEY" | base64 -d | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- 'echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- echo "$KNOWNHOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
rules:
- if: '$CI_COMMIT_BRANCH == "develop" && $CI_PROJECT_PATH == "R3/howto-cards"'
- if: '$CI_COMMIT_BRANCH == "master" && $CI_PROJECT_PATH == "R3/howto-cards"'
- if: '$CI_COMMIT_BRANCH == "16-deploy-to-staticpages-vm"'
script:
- ssh -p $SSHPORT $SSHCONNECT "mkdir -p ~/sources/public/web_$CI_JOB_ID ~/web/public"
- scp -P $SSHPORT -r processed_build/* $SSHCONNECT:~/sources/public/web_$CI_JOB_ID
- ssh -p $SSHPORT $SSHCONNECT "cd ~/web/public && ln -fs ~/sources/public/web_$CI_JOB_ID/* . && cd ~/sources/public/ && find . -type d -not -newermt '-1 minutes' -exec rm -rf {} +;"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment