[英]Problem with Deploying Next.js to Azure App Service using Github Actions
I have problem with deploying next.js to azure app service using github actions currently.我目前使用 github 操作将 next.js 部署到 azure 应用程序服务时遇到问题。 Although I am trying to deploy, I am continuously getting an error that says 'No such file or directory'
虽然我正在尝试部署,但我不断收到“没有这样的文件或目录”的错误
The yaml file is the same as the below. yaml文件同下。
Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy Node.js app to Azure Web App - clsreact3
on:
push:
branches:
- master
env:
AZURE_WEPAPP_NAME: clsreact3
AZURE_WEBAPP_PACKAGE_PATH: '.'
NODE_VERSION: '14.x'
jobs:
build-and-deploy:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: npm install, build, and test
run: |
# Build and test the project, then
# deploy to Azure Web App.
npm install
npm run build --if-present
npm run test --if-present
working-directory: my-app-path
- name: 'Deploy to Azure WebApp'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
If more info is needed, please refer here.如果需要更多信息,请参阅此处。 https://github.com/scl2589/next.js-tutorial
https://github.com/scl2589/next.js-教程
Thanks:)谢谢:)
So you have wrong working-directory: my-app-path
and to make sure that you use correct working directory please add this step before:所以你有错误
working-directory: my-app-path
并确保你使用正确的工作目录请在之前添加此步骤:
- name: List directory
run: |
ls .
I can't provide a better answer as I don't know your project structure.由于我不知道您的项目结构,因此无法提供更好的答案。
I am using their local git deployment method.我正在使用他们本地的 git 部署方法。 By creating a remote (named
azure
) referring to the git of the azure app service (you can get it in deployment section).通过创建一个远程(名为
azure
)引用 azure 应用程序服务的 git(您可以在部署部分获取它)。
I complete my tasks on my repository (on master branch) then I just do this to deploy我在我的存储库(在 master 分支上)上完成我的任务然后我只是这样做来部署
git pull origin master
git push azure master
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.