[go: up one dir, main page]

Add Gitlab CD for auto-deploy to Heroku

Goal

Auto deploy branch master to Heroku

Note: Currently we just use one environment production and this is considered bad practice.

Step-by-Step

  • Get the configuration first HEROKU_API_KEY & HEROKU_APP_NAME from @resir014
  • Create new Gitlab CI/CD config .gitlab.yml

.gitlab.yml contains the following content:

image: node:latest

before_script:
    - apt-get update -qy
    - apt-get install -y ruby-dev
    - gem install dpl

stages:
    - production

production:
    type: deploy
    stage: production
    image: ruby:latest
    script:
        - dpl --provider=heroku --app=$HEROKU_APP_NAME --api-key=$HEROKU_API_KEY
    only:
        - master

Every changes that merged to master will be auto-deployed to heroku

Edited by Zain Fathoni