Deploy your site from GitLab using CI and SFTP

This is an easy thing to do for private repos (we are NOT using variables so only use on Private), using GitLab you get 2K minutes of run time per organization, thats around 2K deploys as most take around 1 minute. To start create a new file in the base of your repo with the name .gitlab-ci.yml.

Here is a simple script to upload your site contents, just replace with the hostname of the node your site is on. Also you will need to set some info in place of USERNAME PASSWORD and YOURMAINDOMAIN. This script will deploy on every push, if you want it to be manual only you can add the flag when: manual under the stage: deploy flag.

    stage: deploy
        - apt-get update -qq
        - apt-get install -y -qq lftp
        - lftp -c "set sftp:connect-program 'ssh -a -x -o PubkeyAuthentication=false'; set sftp:auto-confirm yes; set ssl:verify-certificate no; open s; mirror -Rev ./ ./web/YOURMAINDOMIAN/public_html  --only-newer --parallel=10 --exclude-glob .git* --exclude .git/"

If you want to use variables you can using this link to read more: