Salesforce CI/CD Explained: Deploy Code Without Fear Using Copado or Gearset
By Firus Hanov ยท ยท 10 min read
Learn Salesforce CI/CD: branching strategies, GitHub Actions pipelines, Copado vs Gearset comparison, and deployment best practices for teams of all sizes.

Nothing causes more anxiety in Salesforce development than production deployments. The midnight release, the rollback conversation, the "why are tests failing in production but not in sandbox" post-mortem โ developers who've been through this know the feeling.
CI/CD (Continuous Integration / Continuous Deployment) is the solution. It turns deployment from a nerve-wracking manual event into a reliable, automated, repeatable process. ๐ฅ
What is CI/CD in Salesforce?
Continuous Integration (CI) means every code change is automatically built, tested, and validated as soon as it's committed.
Continuous Deployment (CD) means validated code is automatically deployed to the next environment.
In practice, Salesforce CI/CD looks like this:
- Developer creates a feature branch and writes code in a Developer Sandbox
- Developer commits code and opens a Pull Request
- CI pipeline automatically validates metadata, runs all Apex tests, checks code quality
- Reviewers approve the Pull Request
- CD pipeline deploys to Integration or Staging sandbox
- After UAT sign-off, the pipeline deploys to Production
Branching Strategy for Salesforce
main (mirrors production exactly)
โโโ release/2026.Q1 (staging branch for next release)
โ โโโ feature/JIRA-201-new-lwc-dashboard
โ โโโ feature/JIRA-202-account-trigger-update
โ โโโ bugfix/JIRA-203-email-template-fix
โโโ hotfix/JIRA-204-critical-prod-fix
main โ Reflects exactly what's in production. Never commit directly.
release/[version] โ Accumulation branch for the next release.
feature/[ticket-id]-[description] โ One branch per work item. Short-lived.
hotfix/[ticket-id] โ Emergency fixes that go directly to production.
The PR Gate
Every merge must include: code review, automated CI check passing, and no merge conflicts.
The Salesforce Metadata Model
force-app/
โโโ main/
โโโ default/
โโโ classes/
โโโ triggers/
โโโ lwc/
โโโ flows/
โโโ objects/
โโโ permissionsets/
# Retrieve all metadata
sf project retrieve start --target-org MySandbox
# Deploy to a target org
sf project deploy start --target-org Staging --test-level RunAllTestsInOrg
# Validate without deploying
sf project deploy start --target-org Production --check-only --test-level RunAllTestsInOrg
Setting Up a Basic CI/CD Pipeline (GitHub Actions)
name: Salesforce CI Validation
on:
pull_request:
branches: [release/*, main]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Salesforce CLI
run: npm install -g @salesforce/cli
- name: Authenticate to Staging Org
run: |
echo "${{ secrets.SF_AUTH_URL }}" | sf org login sfdx-url \
--sfdx-url-file /dev/stdin \
--alias StagingOrg
- name: Validate Deployment
run: |
sf project deploy start \
--target-org StagingOrg \
--check-only \
--test-level RunAllTestsInOrg \
--wait 30
Copado: Enterprise Salesforce CI/CD
Copado is the market-leading CI/CD platform purpose-built for Salesforce. It's native โ it runs inside your Salesforce org.
What Copado Does: Pipeline Management, User Story Tracking, Automated Testing, Back-Promotion, Compliance & Audit, Conflict Resolution.
Limitations: Expensive enterprise pricing, complex to configure initially, best for teams of 5+ developers.
Gearset: The Developer-Friendly Alternative
Gearset connects to both your Salesforce orgs and your Git repository from a web interface. Faster to set up and more intuitive.
What Gearset Does: Compare & Deploy, Automated Testing, Pipeline Automation, One-Click Rollback, Change Monitoring, Metadata Health checks.
Deployment Best Practices
Before Every Deployment
- โ All Apex tests pass locally
- โ Metadata reviewed by a second developer
- โ Deployment plan documented
- โ Rollback plan documented
- โ Deploy to a full sandbox first
During Deployment
- โ Deploy during low-traffic hours
- โ Have the rollback plan ready
- โ Monitor the deployment log in real time
- โ Do not deploy on Fridays ๐
After Deployment
- โ Smoke test all critical paths
- โ Verify integrations are functioning
- โ Check error logs
- โ Confirm test coverage didn't drop
Summary
CI/CD transforms Salesforce deployments from "white-knuckle events" into routine, reliable operations:
- Branching strategy: main โ release โ feature branches, all changes via PR
- CI pipeline: Automated validation on every PR
- CD pipeline: Automated deployment after approval
- Tools: Copado for enterprise, Gearset for mid-size teams, SFDX + GitHub Actions for lean teams
Want help setting up CI/CD? Book a consultation with ApexSensei. Start practicing on ApexSensei โ
Are you still using Change Sets? Tell me where your team is in the comments. ๐ฌ