Continuous Deployment to Heroku using Github Actions

459 Views Asked by At

I am using the following yaml file to build my artifacts in the dist directory and push to Heroku.

name: Build and Deploy

on:
  push:
    branches:
      - master

jobs:
  build-and-deploy:

    runs-on: ubuntu-latest
    steps:

      - name: Install SSH Client
        uses: webfactory/[email protected]
        with:
          ssh-private-key: ${{ secrets.DEPLOY_KEY }}

      - name: Checkout
        uses: actions/checkout@master

      - name: Setup Node
        uses: actions/setup-node@master
        with:
          node-version: '14.x'

      - name: Build for production
        run: make build

      - name: Heroku Git Initialize
        env:
          HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
        run: cd dist && git init && heroku git:remote -a ${{ secrets.HEROKU_APP_NAME }}

      - name: Heroku Git Config
        env:
          HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
        run: cd dist && git config user.email "MY-EMAIL" && git config user.name "My Name"

      - name: Heroku Deploy
        env:
          HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
        run: cd dist && git add . && git commit -m "+1" && git push heroku master --force

But, I get the following error on the last step git push heroku master --force.

fatal: could not read Username for 'https://git.heroku.com': No such device or address
Error: Process completed with exit code 128.

How do I solve this issue?

0

There are 0 best solutions below