Skip to content

Instantly share code, notes, and snippets.

@Pamps
Last active November 13, 2022 16:44
Show Gist options
  • Save Pamps/03af7298e3dfffc1fb438979e020599f to your computer and use it in GitHub Desktop.
Save Pamps/03af7298e3dfffc1fb438979e020599f to your computer and use it in GitHub Desktop.
Example Bitbucket Pipeline CI script to deploy a PHP/WordPress website using FTP.
# Auto deploy staging to staging
# Manual deploy master to production
image: php:7.1.29
pipelines:
branches:
staging:
- step:
name: Deploy to Staging
script:
- echo "Deploy to Staging"
- apt-get update -qq && apt-get install -y -qq lftp
- lftp -c "set ftp:ssl-allow no; open -u '$STAGING_USER','$STAGING_PASSWORD' '$STAGING_HOST'; mirror -Rnv ./ / --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"
master:
- step:
script:
- echo "Deploy to Production"
- step:
name: Deploy to Production
script:
- apt-get update -qq && apt-get install -y -qq lftp
- lftp -c "set ftp:ssl-allow no; open -u $PRODUCTION_USER,'$PRODUCTION_PASSWORD' $PRODUCTION_HOST; mirror -Rnv ./ / --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"
trigger: manual
@Pamps
Copy link
Author

Pamps commented Nov 12, 2022

Hi. You can add additional files/folders to the --exclude command.

So change

--exclude .git/

to

--exclude .git/ --exclude your-file.name

@cknazmul
Copy link

Hi,
Thanks a lot for your response. Actually, I have tried this way but not working. Maybe I am missing the accurate position to put it. Can you share with me where to put it?
Thanks in advance!

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