Problem deploying app to heroku using GitHub Actions

If you get the following error when trying to use GitHub actions to deploy a Docker-based app to Heroku: 

 >   Error: This command is for Docker apps only. Switch stacks by running 
 >   heroku stack:set container. Or, to deploy *** with heroku-24, 
Its telling you how to solve it in the error. I don't know why this happened only when I created a new app, it didn't seem to occur for the first app I created. Fixing using the heroku-cli seems like the only solution, I tried for a way to do it using the heroku GUI but it didn't seem possible. First, install heroku-cli:
brew install heroku
Firstly, you have to login:
heroku login
This should launch a webpage where you can login. After that, try to run a command which will list the current stack of your app:
heroku stack
If you get an error message such as:

 >   Error: The following error occurred:
 >   Missing required flag app
 >   See more help with --help
It means your app isn't hooked upto heroku via git. This is required for heroku to send commands. Firstly, make sure you are in the root directory of your app locally, and check the current git remotes:
git remote
If you don't see heroku in the list, add it using:
heroku git:remote --app yourapp
Now, running git remote again should list the heroku remote e.g.:

% git remote
heroku
origin
Now you can run heroku stack to see the available stacks:
  
% heroku stack
=== ⬢ yourapp Available Stacks

  cnb
  container
  heroku-20
  heroku-22
* heroku-24
Switch the stack to the container type to use Docker:
heroku stack:set container
Now push something to git to kick off another GitHub actions build, it should work now.

Comments

Popular posts from this blog

Getting code highlighting working on Blogger

Using PyTorch on Heroku