Skip to content

Latest commit

 

History

History
47 lines (27 loc) · 1.55 KB

README.md

File metadata and controls

47 lines (27 loc) · 1.55 KB

GitHub Actions Tutorial

This is a short example of how to automatically deploy to Heroku any Node.js app using CI/CD pipelines in GitHub Actions.

Check the deployed example here!

Requirements

Steps

  1. First, make sure you are logged in Git.

  2. Also, create an account in Heroku and create an app (this will indicate the URL for your Node.js app when its deployed).

  3. After that, use a terminal on your machine to run the following command:

    heroku login
    
  4. Once you've logged in, you will need to create token to access your account and your app by SSH. Run the following command:

    heroku authorizations:create <app-name>
    

    This command will generate some authentication data, you will need to copy the token data and save it for further actions.

  5. Now that you already have your app token, go to your GitHub Repository > Settings > Secrets > Actions. Here you will add 3 secrets with the corresponding values:

  • HEROKU-API-KEY = <app-token>
  • HEROKU-APP = <your-app-name>
  • HEROKU-EMAIL = <your-email>

Setup your Actions

You can setup your actions directly in your GitHub repo or by manually creating a .github > workflows > main.yml folders and file in your project.

Either way, you can follow the example written in this tutorial and adapt it to your project.

Recommended videos