Deploy to Netlify Github Actions not working

Viewed 236

I'm trying to deploy a subdirectory of my repo to netlify, client, and it's not working, the GitHub action actually succeeds but the netlify deploy log says "No build command found, continuing to publishing",

my yml file:

defaults:
  run:
    working-directory: client

jobs:
   build:
     runs-on: ubuntu-latest

     steps:
       - uses: actions/checkout@v2

       - name: Use Node.js 14
         uses: actions/setup-node@v1
         with:
           node-version: 14.10.1

       - name: install client dependencies
         run: npm ci
         working-directory: client

       - run: npm run build
         working-directory: client

       - name: Netlify Deploy
         uses: netlify/actions/build@master
         env:
           NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
           NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
           NETLIFY_DIR: build

I've also changed it to

NETLIFY_BASE: client
NETLIFY_CMD: npm build
NETLIFY_DIR: client/build

and same thing

1 Answers

I had the same problem.

My workflow file is working after a lot of tries.

There are 2 things you need to try

Try netlify build hook.

And use

      # Runs a single command using the runners shell
      - name: Deploy netlify
        run: curl -X POST -d {} curl -X POST -d {} ${{ NETLIFY_BUILD_HOOK }}

You can find the build hook in deploy setting in netlify. You can create a secret in github setting or

Second change the build command to (this will probably do the trick)

CI='' npm run build

instead of

npm run build

Under settings>build and deploy>dontinuous deployment>build settings

After making the following changes the GitHub action will be triggered and if not you can trigger it manually under the actions tab.

Related