Skip to content

Instantly share code, notes, and snippets.

@bwangila
Created November 20, 2018 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwangila/d841dc466ba5c013e1603fff0e54d01f to your computer and use it in GitHub Desktop.
Save bwangila/d841dc466ba5c013e1603fff0e54d01f to your computer and use it in GitHub Desktop.
GitLab Pipelines CI configuration file to upload changed files to your server when pushed to GitLab
# =========================================================== #
# Configureation file for GitLab Pipelines FTP deployment. #
# #
# Everytime you push you code to Gitlab, the master #
# branch gets automagically uploaded to your server via FTP. #
# #
# =========================================================== #
# #
# You can learn more at https://docs.gitlab.com/ee/ci/yaml/ #
# Or for a quick setup: #
# 1) Line 33 - Enter the local directory to mirror. "./" #
# defaults to all files in repo. #
# 2) Line 33 - Enter the remote directory to mirror your repo #
# to - no trailing slashes. #
# 3) In your GitLab repo settings under CI/CD, enter your FTP #
# details in the Variables section #
# #
# =========================================================== #
# Add all the various deployment job stages you need
stages:
- build
- test
- deploy
# Files & directories to cache between jobs
#cache:
# paths:
# - vendor
# upload job, see https://lftp.yar.ru/lftp-man.html
upload:
stage: deploy
script:
# Use apt-get to install lftp - an ftp tool
- apt-get update -qq && apt-get install -y -qq lftp
# Use lftp to connect to server and upload files.
# $USERNAME, $PASSWORD, $HOST - define this in Pipeline Settings in Gitlab.
# "mirror -Rev" => -R is reverse mirror to put files on the server, "e" deletes files on the server
# not present in the repo, "v" stands for verbose.
- lftp -c "set ftp:ssl-allow no; open -u $USERNAME,$PASSWORD $HOST; mirror -Rev ./ ./dynamic.documentaryafrica.hostimatum.com/wp-content/themes/skyline-doca --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/ .idea/"
only:
- master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment