Bitbucket isn’t just for code hosting — it also has a built-in CI/CD system called Bitbucket Pipelines.
If your repositories are hosted on Bitbucket, this tool can automatically build, test, and deploy your app whenever you push new commits — similar to GitHub Actions or GitLab CI/CD.
In this tutorial, you’ll learn how to set up Bitbucket Pipelines to automate your website deployment step by step.
See Also: How to Deploy Containerized Apps with Docker Compose (Step-by-Step Guide)
What Is Bitbucket Pipelines?
Bitbucket Pipelines lets you:
- Define automated workflows using a
bitbucket-pipelines.ymlfile. - Run builds and tests in a cloud container environment.
- Deploy to hosting providers, servers, or cloud platforms.
It’s ideal for teams already using Atlassian tools like Jira or Trello.
Step 1: Enable Pipelines
- Go to your Bitbucket repository.
- Navigate to Repository Settings → Pipelines → Enable Pipelines.
Bitbucket will now look for a bitbucket-pipelines.yml file in your project.
Step 2: Create the Pipeline File
In your project root, add bitbucket-pipelines.yml:
image: node:18
pipelines:
branches:
main:
- step:
name: Build and Deploy
caches:
- node
script:
- npm ci
- npm run build
- pipe: atlassian/ftp-deploy:0.3.6
variables:
USER: $FTP_USER
PASSWORD: $FTP_PASS
SERVER: ftp.yourhost.com
REMOTE_PATH: /public_htmlExplanation:
- Uses Node.js to build your site.
- Deploys via FTP to your hosting provider automatically.
- Credentials are stored securely as repository variables.
Step 3: Add Environment Variables
Go to Repository Settings → Pipelines → Repository Variables and add:
FTP_USERFTP_PASS
If you’re using another host (like AWS or Netlify), you can add their API tokens here instead.
Step 4: Add a Custom Deployment (Example: AWS S3)
Here’s how to deploy a static site to AWS S3:
image: python:3.10
pipelines:
branches:
main:
- step:
name: Deploy to S3
script:
- pip install awscli
- aws s3 sync ./build s3://mybucket --delete
services:
- dockerYou’ll also need AWS credentials (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) added as environment variables.
Step 5: Test and Monitor
Push your changes:
git add bitbucket-pipelines.yml
git commit -m "Add Bitbucket pipeline"
git pushGo to Bitbucket → Pipelines tab to view logs, status, and deployment results in real-time.
Bonus: Add Multiple Environments
You can define multiple environments for staging and production:
pipelines:
branches:
staging:
- step:
name: Deploy to Staging
script:
- npm run build:staging
main:
- step:
name: Deploy to Production
script:
- npm run build && npm run deployConclusion
Bitbucket Pipelines is an excellent CI/CD option for teams already working in the Atlassian ecosystem.
With just one YAML file, you can automatically build, test, and deploy your apps every time you push new changes — no extra servers required.
Coming up next in Hosting Academy: you’ll learn how to host a website on an Nginx VPS and configure SSL with Certbot for production-ready performance.

