Skip to content

Commit 3f99dc6

Browse files
Merge pull request circleci#2083 from AnthonyNahas/patch-1
Updated deploy config for heroku
2 parents 607aa2b + 5d3cd12 commit 3f99dc6

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

jekyll/_cci2/deployment-integrations.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,63 @@ workflows:
189189
only: master
190190
```
191191

192+
If you prefer to deploy to Heroku using https, please consider this circleci (2.0) configuration which is even easier:
193+
194+
Since we are deploying our app with https, the bash script above needed to setup heroku with ssh is not required anymore.
195+
For that reason the following steps can be deleted from the configuration:
196+
197+
```yaml
198+
- add_ssh_keys: # add key from CircleCI account based on fingerprint
199+
fingerprints:
200+
- "48:a0:87:54:ca:75:32:12:c6:9e:a2:77:a4:7a:08:a4"
201+
- run:
202+
name: Run Setup Script
203+
command: bash .circleci/setup-heroku.sh
204+
```
205+
206+
instead we use the following step
207+
208+
```yaml
209+
- run:
210+
name: Deploy to Heroku
211+
command: |
212+
git push https://heroku:[email protected]/$HEROKU_APP_NAME.git HEAD:refs/heads/master
213+
sleep 5 # sleep for 5 seconds to wait for dynos
214+
heroku restart
215+
```
216+
217+
- Result:
218+
219+
```yaml
220+
version: 2
221+
jobs:
222+
# jobs for building/testing go here
223+
deploy-job:
224+
docker:
225+
- image: my-image
226+
working_directory: /tmp/my-project
227+
steps:
228+
- checkout
229+
- run:
230+
name: Deploy Master to Heroku
231+
command: | # this command is framework-dependent and may vary
232+
heroku git:remote -a HEROKU_APP_NAME
233+
git push --force https://heroku:[email protected]/$HEROKU_APP_NAME.git HEAD:refs/heads/master
234+
sleep 5 # sleep for 5 seconds to wait for dynos
235+
heroku restart
236+
workflows:
237+
version: 2
238+
build-deploy:
239+
jobs:
240+
- build-job
241+
- deploy-jobs: # only deploy when master successfully builds
242+
requires:
243+
- build-job
244+
filters:
245+
branches:
246+
only: master
247+
```
248+
192249
For additional details,
193250
refer to the full example in the [2.0 Project Tutorial]({{ site.baseurl }}/2.0/project-walkthrough/).
194251

0 commit comments

Comments
 (0)