Hi there,
I have configured GitLab CI to deploy Laravel project to the server but I have one problem: In my project users can upload files to their profile but when I deploy the project users uploaded file will be deleted
This is my configuration file
deploy_release:
stage: deploy
image: tetraweb/php:7.1
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- '[[ -f /.dockerenv ]] && echo -e "Host *ntStrictHostKeyChecking nonn" > ~/.ssh/config'
- ssh-add <(echo "$PRIVATE_KEY")
- ssh-keyscan -H 'example.com' >> $HOME/.ssh/known_hosts
- apt-get install rsync
script:
- ssh -p22 example@example.com "mkdir -p ~/public_html/dev"
- ssh -p22 example@example.com "mkdir -p ~/public_html/dev_tmp"
- ssh -p22 example@example.com "mkdir -p ~/public_html/dev_old"
- rsync -rav -e ssh --exclude='.git/' --exclude='.gitlab-ci.yml' --delete-excluded ./ example@example.com:~/public_html/dev_tmp
- ssh -p22 example@example.com "mv ~/public_html/dev ~/public_html/dev_old"
- ssh -p22 example@example.com "mv ~/public_html/dev_tmp ~/public_html/dev"
- ssh -p22 example@example.com "cp ~/gasha_laraconfig.sh ~/public_html/dev/laraconfig.sh"
- ssh -p22 example@example.com "~/public_html/dev/laraconfig.sh"
- ssh -p22 example@example.com "rm -rf ~/public_html/dev_old"
only:
- release
Thanks in advance.