简体   繁体   English

部署到 Netlify Github 操作不起作用

[英]Deploy to Netlify Github Actions not working

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",我正在尝试将我的 repo 的子目录部署到 netlify 客户端,但它不起作用,GitHub 操作实际上成功但 netlify 部署日志显示“未找到构建命令,继续发布”,

my yml file:我的 yml 文件:

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和同样的事情

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.尝试 netlify 构建钩子。

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.您可以在 netlify 的部署设置中找到构建挂钩。 You can create a secret in github setting or您可以在 github 设置中创建一个秘密或

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.进行以下更改后,将触发 GitHub 操作,如果没有,您可以在操作选项卡下手动触发它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM