Salesforce CI/CD using Github Actions
Introduction:
In the modern agile world, Continuous Integration and Continuous Deployment (CI/CD) have become a staple for delivering high-quality software efficiently. In the Salesforce ecosystem, leveraging CI/CD pipelines not only accelerates the delivery but also ensures a robust, error-free deployment. In this article, we will explore constructing a CI/CD pipeline using GitHub Actions, utilizing sfdx
& sfdx-git-delta
for delta deployments and leveraging a private Docker image hosted on AWS ECR (Amazon Elastic Container Registry).
Setting the Stage with GitHub Actions:
GitHub Actions offers an array of automation capabilities directly within the GitHub environment. This feature allows developers to build, test, and deploy code from GitHub. Moreover, GitHub Actions provide a cost-effective solution compared to other CI/CD tools in the market. This makes it a go-to choice for many organizations looking to streamline their Salesforce deployment process without leaving source code from GitHub.
To enable the GitHub actions, requires to create a .yml file inside the .github/workflows directory of your project.
We will be using an ECR image to ensure a controlled and secure pipeline that runs smoothly on every deployment.
A docker image for salesforce deployment can be created by using the below docker file:
Once the docker image is created, it should uploaded in ECR to get the image details required in the GitHub action. Using ECR in Github Actions is a little bit tricky, which can be found in the below snippet:
The JWT authentication process & git-delta specific things are not covered in detail to keep it short.