Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
upload-cloud

GitHub Action

Heroku Build

v1.1

Heroku Build

upload-cloud

Heroku Build

Deploy to Heroku using the Platform API

Installation

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

              

- name: Heroku Build

uses: behe/heroku-build@v1.1

Learn more about this action in behe/heroku-build

Choose a version

Heroku Build

GitHub

Getting Started

To get started using the action, just make sure to have a Procfile or a Dockerfile in your project and then create a folder called .github and inside it, create another folder called workflows. Finally inside the workflows folder, create a file called main.yml with the following contents:

.github/workflows/main.yml

name: Deploy

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Deploy to Heroku
        uses: behe/heroku-build@v1.1
        with:
          app-name: "your-app-name-on-heroku"
          api-key: "${{secrets.HEROKU_API_KEY}}"
          path: "optional-path-of-build-to-deploy"

Now go to your Heroku account and go to Account Settings. Scroll to the bottom until you see API Key. Copy this key and go to your project's repository on GitHub.

In your Repo, go to Settings -> Secrets and click on "New Secret". Then enter HEROKU_API_KEY as the name and paste the copied API Key as the value.

You can now push your project to GitHub and it will be automatically deployed to Heroku henceforth.

You learn more about GitHub Secrets here and GitHub Actions here