簡體   English   中英

使用 Github 操作將 Next.js 部署到 Azure 應用程序服務時出現問題

[英]Problem with Deploying Next.js to Azure App Service using Github Actions

我目前使用 github 操作將 next.js 部署到 azure 應用程序服務時遇到問題。 雖然我正在嘗試部署,但我不斷收到“沒有這樣的文件或目錄”的錯誤

在此處輸入圖像描述

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 }}

如果需要更多信息,請參閱此處。 https://github.com/scl2589/next.js-教程

謝謝:)

所以你有錯誤working-directory: my-app-path並確保你使用正確的工作目錄請在之前添加此步驟:

 - name: List directory
      run: |
         ls .

由於我不知道您的項目結構,因此無法提供更好的答案。

我正在使用他們本地的 git 部署方法。 通過創建一個遠程(名為azure )引用 azure 應用程序服務的 git(您可以在部署部分獲取它)。

我在我的存儲庫(在 master 分支上)上完成我的任務然后我只是這樣做來部署

git pull origin master
git push azure master

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM