Skip to content

Instantly share code, notes, and snippets.

@replete
Last active March 15, 2022 23:04
Show Gist options
  • Save replete/bd3f0cf5a0c6e54d78a3af160812677b to your computer and use it in GitHub Desktop.
Save replete/bd3f0cf5a0c6e54d78a3af160812677b to your computer and use it in GitHub Desktop.
Bitbucket Pipelines deploy to FTP
Step 1:
Create a new Bitbucket pipeline with the following yaml, then add environment variables (in the bitbucket web UI) for FTP_HOST, FTP_USERNAME, FTP_PASSWORD - update host path below accordingly.
Step 2: Commit this file, once a build passess successfully and it has initialized Git FTP, proceed to Step 3
```bitbucket-pipelines.yml
image: atlassian/default-image:3
pipelines:
default:
- step:
script:
- echo "Pipeline Init"
- apt-get update
- apt-get -qq install git-ftp
- echo "'_$(git status -uno --porcelain | wc -l)_'"
- git status -uno --porcelain
- echo "Initiating Push site:Source."
- git config git-ftp.syncroot dist/
- git ftp init --user "$FTP_USERNAME" --passwd "$FTP_PASSWORD" ftp://$FTP_HOST/
```
Step 3: Update this pipeline file by changing `git ftp init` to `git ftp push`, and push the changes in a commit to trigger another build. Subsequent builds will now deploy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment