Full Stack Software Developer

Deploy with Circle CI on shared hosting via FTP

The following config.yml script can be used in circle CI to deploy code from github / bitbucket to any hosting provider with FTP credentials. Please note the FTP credentials will have to be saved as environment variables in circle CI with the following names FTP_USER, FTP_PWD, FTP_LOCATION. Example of the values for the environment variables can be
FTP_USER = “user@abc.com”, FTP_PWD = “abc45sdd”, FTP_LOCATION = “ftp://abc.com/”.

version: 2
jobs:
  deploy:
    docker:
      - image: circleci/php:7.1.5-browsers

    working_directory: ~/repo

    steps:
      - checkout

      - run: 
          name: Deploy Master Branch
          command: |
            sudo apt-get update
            sudo apt-get -qq install git-ftp
            echo "Deploying project ..."
            echo $(git status)
            git ftp init --init-if-not-exist --user "${FTP_USER}" --passwd "${FTP_PWD}" ${FTP_LOCATION}

workflows:
  version: 2
  just-deploy:
    jobs:
      - deploy:
          filters:
            branches:
              only: master

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.