Skip to content

Instantly share code, notes, and snippets.

@mcnamee
Last active December 14, 2023 03:57
Show Gist options
  • Save mcnamee/aa141afde5c0359c568c169a56f100d7 to your computer and use it in GitHub Desktop.
Save mcnamee/aa141afde5c0359c568c169a56f100d7 to your computer and use it in GitHub Desktop.
Bitbucket Pipelines - Deploy via FTP to shared hosting
# Installation ---
# 1. In Bitbucket, add FTP_USERNAME, FTP_PASSWORD and FTP_HOST as environment variables.
# 2. Commit this file (bitbucket-pipelines.yml) to your repo (in the repo root dir)
# 3. From Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:Init (this will
# push everything and initialize GitFTP)
#
# Usage ---
# - On each commit to master branch, it'll push all files to the $FTP_HOST
# - You also have the option to 'init' (see 'Installation' above) - pushes everything and initialises
# - Finally you can also 'deploy-all' (from Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:deploy-all)
# if multiple deploys fail, you can deploy everything to "catch up"
#
image: wearepvtl/bitbucket-pipelines-git-ftp:latest
pipelines:
custom: # Pipelines that are triggered manually via the Bitbucket GUI
init: # -- First time init
- step:
caches:
- node
- composer
script:
- npm install
- git ftp init -u "$FTP_USERNAME" -p "$FTP_PASSWORD" ftp://$FTP_HOST
deploy-all: # -- Deploys all files from the selected commit
- step:
caches:
- node
- composer
script:
- npm install
- git ftp push -u "$FTP_USERNAME" -p "$FTP_PASSWORD" ftp://$FTP_HOST --all
branches: # Automated triggers on commits to branches
master: # -- When committing to master branch
- step:
deployment: production
caches:
- node
- composer
script:
- npm install
- git ftp push -u "$FTP_USERNAME" -p "$FTP_PASSWORD" ftp://$FTP_HOST
@mcnamee
Copy link
Author

mcnamee commented Dec 6, 2020

Hi @thorst - thanks for letting me know. I've setup a new Docker image and updated the script above.
Simply update the reference image to image: wearepvtl/bitbucket-pipelines-git-ftp:latest (from image: aariacarterweir/lamp-gitftp:latest)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment