asp.net core - Why does web app (linux) deployment via gitactions fails after running for 1 hour even though I am using the depl

I have set up two pipelines to deploy a front end (React) and a back end (.NET8) , To integrate GitHub

I have set up two pipelines to deploy a front end (React) and a back end (.NET8) , To integrate GitHub actions to web apps I have used deployment center (web apps), The pipeline for deploying back end runs perfect but the pipeline for the front end fails after running for 1 hour, Below is the pipeline code for the deployment step

jobs:
      # Step 5: Deploy the app to Azure Web App
      - name: Deploy web app using Azure credentials
        uses: azure/webapps-deploy@v3
        with:
          app-name: ${{ env.AZURE_WEBAPP_NAME }}
          package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

Below is the exact error; "Package deployment using OneDeploy initiated. Error: Failed to deploy web package to App Service. Error: Deployment Failed, Error: Failed to deploy web package using OneDeploy to App Service." I have tried multiple time like creating custom pipelines and using az cli etc but the same issue occurs.

I was expecting that the front end will smoothly be deployed as we are using an azure service for integration and pipeline but "azure/webapps-deploy@v3" is not functioning as it is supposed to function.

I have set up two pipelines to deploy a front end (React) and a back end (.NET8) , To integrate GitHub actions to web apps I have used deployment center (web apps), The pipeline for deploying back end runs perfect but the pipeline for the front end fails after running for 1 hour, Below is the pipeline code for the deployment step

jobs:
      # Step 5: Deploy the app to Azure Web App
      - name: Deploy web app using Azure credentials
        uses: azure/webapps-deploy@v3
        with:
          app-name: ${{ env.AZURE_WEBAPP_NAME }}
          package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}

Below is the exact error; "Package deployment using OneDeploy initiated. Error: Failed to deploy web package to App Service. Error: Deployment Failed, Error: Failed to deploy web package using OneDeploy to App Service." I have tried multiple time like creating custom pipelines and using az cli etc but the same issue occurs.

I was expecting that the front end will smoothly be deployed as we are using an azure service for integration and pipeline but "azure/webapps-deploy@v3" is not functioning as it is supposed to function.

Share Improve this question edited Nov 26, 2024 at 8:58 Jason Pan 22k2 gold badges21 silver badges45 bronze badges asked Nov 20, 2024 at 14:46 AbaizAbaiz 639 bronze badges 3
  • I don't understand what two pipelines means, but follow my steps and you will be able to publish your app quickly. If you still have problems, I suggest you create a new azure app service and try it. – Jason Pan Commented Nov 26, 2024 at 8:58
  • One pipeline to deploy the frontend to the frontend-app-service and the other one to deploy backend to backend-app-service . On the Github there are two separate branches i.e one for the front end and the other one for the backend. I have created multiple app services for test purpose but the same issue occurs, I have tried many ways that include the steps you mentioned below but still facing the same issue. – Abaiz Commented Nov 26, 2024 at 14:48
  • Maybe its something with the ubuntu machine . – Abaiz Commented Nov 26, 2024 at 14:49
Add a comment  | 

1 Answer 1

Reset to default 0

We actually only need to publish the backend project. I created a template project from VS2022, and the file structure after uploading is as follows.

Then we can add github action in azure portal deployment center.

Here is my .yml file.

# Docs for the Azure Web Apps Deploy action: https://github/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github/Azure/actions

name: Build and deploy ASP.Net Core app to Azure Web App - jasonlinuxspa

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Set up .NET Core
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: '8.x'

      - name: Build with dotnet
        run: dotnet build --configuration Release

      - name: dotnet publish
        run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp

      - name: Upload artifact for deployment job
        uses: actions/upload-artifact@v4
        with:
          name: -app
          path: ${{env.DOTNET_ROOT}}/myapp

  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@v4
        with:
          name: -app
      
      - name: Deploy to Azure Web App
        id: deploy-to-webapp
        uses: azure/webapps-deploy@v3
        with:
          app-name: 'jasonlinuxspa'
          slot-name: 'Production'
          package: .
          publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_B2***3D1E4B724 }}

Test Result

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742353289a4427940.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信