0

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.

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. 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. Commented Nov 26, 2024 at 14:48
  • Maybe its something with the ubuntu machine . Commented Nov 26, 2024 at 14:49

1 Answer 1

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.

enter image description here

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

enter image description here

Here is my .yml file.

# 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 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: .net-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: .net-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

enter image description here

enter image description here

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.