870dace767 | ||
---|---|---|
config | ||
force-app | ||
.forceignore | ||
.gitignore | ||
.salesforcedx.yml | ||
LICENSE | ||
README.md | ||
app.json | ||
setup.sh | ||
sfdx-project.json |
README.md
salesforce-dx-pipeline-sample
Using this sample app and the resources in this repo, you can setup a Heroku Pipeline to drive CI / CD for Salesforce DX. This sample uses the salesforce-dx-buildpack and the salesforce-cli-buildpack.
To make any Salesforce DX app work with Heroku Pipelines using this method, you only need two things:
-
Create a
app.json
file. -
Create a
.salesforcedx.yml
file.
That's it. The buildpacks will do the rest.
Setup
-
Install the Heroku CLI.
-
Install the Salesforce CLI.
-
Log into the four orgs you'll use with the Salesforce CLI and give them aliases:
- Dev Hub (e.g.. "HubOrg"): this will create scratch orgs for your Review Apps
- Development Org (e.g. "DevOrg"): this is the first environment you'll update using a metadata deploy
- Staging Org (e.g. "TestOrg"): this is the first environment from which you'll promote your code via release phase
- Prod Org : "ProdOrg": this is your production org
-
Ensure you see all four orgs when you run
sfdx force:org:list
. -
Fork this repository.
-
Clone the repository locally.
-
Update the values in
setup.sh
accordingly (e.g.HEROKU_TEAM_NAME
,DEV_HUB_USERNAME
,DEV_USERNAME
,STAGING_USERNAME
, andPROD_USERNAME
). -
Run
./setup.sh
.
Unfortunately there's a bug in heroku pipelines:setup
that prevents us from fully setting up the pipeline. To manually finish the setup, perform the following steps:
-
Open your pipeline:
heroku pipelines:open <YOURPIPELINENAME>
-
Click Settings.
-
Search for "salesforce-dx-pipeline-sample" and click Connect.
-
Clic Pipelines.
-
Click Enable Review Apps.... Check both boxes and click Enable.
-
Under development, click the expansion button and then click Configure automatic deploys... Then click Enable Automatic Deploys.
Now you're all set.
Usage
To demo, simply submit a pull request. It's easiest to do through the Github UI. Simply edit a page, then instead of committing directly to the branch, create a pull request. Once created, the review app is ready to go. When the pull request is accepted, the review app is deleted and the application is deployed to your staging org.
Clean up
At any time you can run ./destroy.sh
to delete your pipeline and apps.