部署进行中

问题描述 投票:0回答:1

我正在尝试使用 github actions 部署 React Web 应用程序,但在此之前我的部署仍在进行几个小时,然后给我错误。我只是部署一个简单的反应应用程序,这需要很多时间。我尝试使用不同的区域并连续面对同样的问题。请问有人知道如何解决这个问题吗?

当我尝试将 React 应用程序部署到 Azure 时,它没有完成。

azure github deployment github-actions
1个回答
0
投票

根据问题中提供的屏幕截图,由于

Microsoft.Web/serverfarms
,您似乎陷入了
BadGateway

  • 这可能是由于启用
    Microsoft.Web
    资源提供程序时出现后端延迟。
  • 几个小时后重试创建应用服务。

在应用服务创建期间配置 GitHub 部署。

  • 创建 NodeJS 应用服务的持续时间,导航至
    Deployment section=> enable Continuous Deployment=>Select GitHub repository of react project

enter image description here

Enable Basic Authentication
和审核+创建。

enter image description here

  • 这将创建使用 GitHub 操作将应用程序部署到 Azure 的工作流程。

我的工作流程:

name: Build and deploy Node.js app to Azure Web App - <appname>

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Set up Node.js version
        uses: actions/setup-node@v3
        with:
          node-version: '20.x'

      - name: npm install, build, and test
        run: |
          npm install
          npm run build --if-present
          npm run test --if-present
      - name: Zip artifact for deployment
        run: zip release.zip ./* -r

      - name: Upload artifact for deployment job
        uses: actions/upload-artifact@v3
        with:
          name: node-app
          path: release.zip

  deploy:
    runs-on: ubuntu-latest
    needs: build
    environment:
      name: 'Production'
      url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
    
    steps:
      - name: Download artifact from build job
        uses: actions/download-artifact@v3
        with:
          name: node-app

      - name: Unzip artifact for deployment
        run: unzip release.zip
      
      - name: 'Deploy to Azure Web App'
        id: deploy-to-webapp
        uses: azure/webapps-deploy@v2
        with:
          app-name: '<appname>'
          slot-name: 'Production'
          package: .
          publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_3134D1CCXXXXFAC }}
  • 我已使用 GitHub 操作将示例 React 应用程序部署到 Azure。

传送门:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.