You will need roughly 5 minutes to read this article.
Codeship makes it easy to deploy your application to Heroku using Codeship’s integrated deployment pipelines.
Note that this documentation refers to the new Heroku Deployment template, which uses the Heroku API instead of the older
git push method. The main difference between the two methods is that the new method copies files from the build environment directly to Heroku, as opposed to the old method that pushed the final files to a git repo, which Heroku then deployed from.
For more details on how the Heroku Platform API works, see the Heroku Dev Center
Navigate to your project’s deployment configuration page by selecting Project Settings on the top right side of the project page, and then the Deploy option in the secondary navigation.
Edit an existing deployment pipeline or create a new deployment pipeline by selecting + Add new deployment pipeline. If you create a new deployment pipeline, you need to select when it’s triggered. You can either match the exact name of a branch or a specify a wildcard branch.
Now we’re ready to configure your Heroku deployment.
Select the Heroku template from the list of available deploy templates.
Next step is to provide the application name and API key.
Copy-paste the name of the Heroku application you want the pipeline to deploy to.
In order for you to deploy your app using Codeship, you need to provide the Heroku API key from your Heroku account. You can access your Heroku API key here.
You have now successfully setup deployment to Heroku. Go ahead and push a commit to your configured deploy branch.
You can configure additional settings to your Heroku deployment by selecting More Options:
After each deployment, we check your application to make sure that it is up. We will either call the default
*.herokuapp.com URL or the URL you specified here.
If this URL requires basic auth please enter:
You can specify a command to run post-deployment. This can be useful for running migrations or other commands that need to be run on each deploy.
This will enable your build to check the URL of your application to make sure that it is up.
This is what will be uploaded to Heroku. If you have your deployment files in a sub-folder, e.g.
/dist specifying that here will ensure only your deployment files are uploaded.
The public SSH key for your Codeship project should automatically get added to Heroku when you setup the deployment. If the key is missing or incorrect you may see an error like this during the
git push step of the deploy:
Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
To fix this issue, get the public SSH key for your project under Project Settings > General and add it to Heroku.
During a Heroku deployment you might encounter this error on the step that syncs your project’s SSH key to Heroku:
This key is already in use by another account. Each account must have a unique key.
To fix this issue, visit Project Settings > General and click Reset project SSH key. This will reset the SSH key for the project and add the new key to the repository on your SCM. The next time you deploy the new SSH key will automatically sync to Heroku.
After each deployment we check if your app is up. Therefore we call (
wget) either the default
*.herokuapps.com URL or the URL you specified here.
If the build fails during
check_url YOUR_URL it’s usually because your application does not respond with a HTTP/2xx status code at the URL you provided (or the default URL for the deployment if you didn’t provide any).
To solve this, you can:
Respond with a HTTP/200 status code at the root of your application.
Configure a URL that will respond with such an status code in the advanced deployment configuration.
Note that you can disable the check URL functionality by unselecting the “Check app URL” option on the deployment configuration.
Contact our support team or post on Stack Overflow using the tag
#codeship. Did you check the status page and changelog?
There are also several code examples and sample projects available for you to get started with.