Skip to content

Instantly share code, notes, and snippets.

@marufmax
Forked from mcnamee/bitbucket-pipelines.yml
Created January 17, 2019 11:44
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 marufmax/e3933ba7cce533a9b31a3d4e6b2a0b24 to your computer and use it in GitHub Desktop.
Save marufmax/e3933ba7cce533a9b31a3d4e6b2a0b24 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 to your repo
# 3. From Bitbucket Cloud > Commits > Commit Number > Run Pipeline > Custom:Init (this will
# push everything and initial GitFTP)
#
# Usage ---
# - On each commit to master branch, it'll push all files to the $FTP_HOST
# - You also have the option to 'init' (from Bitbucket Cloud) - pushes everything and initialises
# - Finally you can also 'deploy-all' (from Bitbucket Cloud) - if multiple deploys fail, you
# can deploy everything to "catch up"
#
image: aariacarterweir/lamp-gitftp: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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment