For a fully guided walk through of setting up and configuring this sample, see the Continuous Integration Using Salesforce DX Trailhead module.
This repository shows one way you can successfully setup Salesforce DX with Travis CI. We make a few assumptions in this README:
- You know how to get your Github repository setup with Travis CI. (Here's their Getting Started guide.)
- You've installed the Travis CLI.
- You have properly setup JWT-Based Authorization Flow (i.e. headless). I recommend using these steps for generating your Self-Signed SSL Certificate.
If any any of these assumptions aren't true, the following steps won't work.
Make sure you have the Salesforce CLI installed. Check by running
sfdx force --helpand confirm you see the command output. If you don't have it installed you can download and install it from here.
Confirm you can perform a JWT-based auth:
sfdx force:auth:jwt:grant --clientid <your_consumer_key> --jwtkeyfile server.key --username <your_username> --setdefaultdevhubusername
Fork this repo into your github account using the fork link at the top of the page.
Clone your forked repo locally:
git clone https://github.com/<git_username>/sfdx-travisci.git
From you JWT-Based connected app on Salesforce, retrieve the generated
Usernameusing the Travis CLI. Note that this username is the username that you use to access your Dev Hub.
travis env set CONSUMERKEY <your_consumer_key> travis env set USERNAME <your_username>
server.keythat you generated previously to the folder called
.travis.ymlfile and remove the first line that starts with
openssl ...and save the file.
From the root folder of your local project, encrypt your
travis encrypt-file assets/server.key assets/server.key.enc --add
IMPORTANT! Remove your
rm assets/server.key, you should never store keys or certificates in a public place.
And you should be ready to go! Now when you commit and push a change, your change will kick off a Travis CI build.
Contributing to the Repository
If you find any issues or opportunities for improving this repository, fix them! Feel free to contribute to this project by forking this repository and make changes to the content. Once you've made your changes, share them back with the community by sending a pull request. Please see How to send pull requests for more information about contributing to Github projects.
If you find any issues with this demo that you can't fix, feel free to report them in the issues section of this repository.