Skip to content
stop-circle

GitHub Action

Heroku Action

v1.0 Latest version

Heroku Action

stop-circle

Heroku Action

GitHub Action for deploying on Heroku

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Heroku Action

uses: CDNievas/[email protected]

Learn more about this action in CDNievas/heroku-action

Choose a version

Heroku Action

A GitHub Action for deploying on Heroku. Based on heroku-deploy

Basic Example

In this example you must have a Procfile in the project directory and create the following file (.github/workflows/main.yml)

name: Deploy

on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: CDNievas/[email protected] # This is the action
        with:
          heroku_email: "[email protected]"
          heroku_api_key: ${{secrets.HEROKU_API_KEY}}
          heroku_app_name: "this-is-an-example"

Options

You can configure the deploy to heroku passing some options to the action

Name Type Description Example Required Default
heroku_api_key string Used like a password for authentication. Visit your profile settings on Heroku to obtain. "0a3efa20-0a3efa20a3efa2" true -
heroku_email string Heroku account's email. "[email protected]" true -
heroku_app_name string The name of the Heroku app that you are deploying. It must be all in minus and separated using "-". "this-is-an-example" true -
branch string The name of the repository branch that you want to upload to Heroku. "main", "deploy", "test" false Uploads "HEAD" content
useforce bool Set in true if you want to add --force to the push to Heroku command. true, false false false
appdir string Directory that you want to deploy to Heroku. "project", "deploy" false Root of repository
procfile string Content of the Procfile. It will be created dynamically and uploaded only to Heroku. "web: npm start" false No Procfile creation
dynamicFiles bool Set in true if you need to upload to Heroku files created dynamically by others steps in the GitHub Action. true, false false false
buildpacks string If you want to add custom buildpacks to the project pass the URLs in string array format. There will be installed respecting the order used. "['url_buildpack1','url_buildpack2']" false No buildpacks
env_file string Path to a .env file ".env", "secrets/.env/" false No env file

Example with some options

name: Deploy

on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: CDNievas/[email protected] # This is the action
        with:
          heroku_email: "[email protected]"
          heroku_api_key: ${{secrets.HEROKU_API_KEY}}
          heroku_app_name: "this-is-an-example"
          useforce: true,
          dynamicFiles: true,
          procfile: "worker: npm start",
          buildpacks: "['https://github.com/heroku/heroku-buildpack-nodejs.git','https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest.git']"