0

I'm pretty new on Azure e Git usage and I'm having some problems to deploy 2 WebJob to Azure App Service via Git. When I deploy one of them it replaces the other. Am I missing some configuration?

When the deploy goes via Visual Studio works fine, I can get this 2 WebJobs together but I really need to know how to do it via Git.

.yml


on:
  workflow_dispatch:  

env:
  WEBJOB1_NAME: CUSTOMER
  WEBJOB2_NAME: PRODUCT  
  DOTNET_VERSION: '3.1.x'

jobs:   
            
  customer-dev-release:
    name: Release customer to DEV
    runs-on: ubuntu-latest
    environment: CUSTOMER-DEV
    steps:
      # Checkout the repo
      - uses: actions/checkout@v2

      # Setup .NET Core SDK
      - name: Setup .NET Core
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: ${{ env.DOTNET_VERSION }}
        
      - name: Build with dotnet        
        run: |
          dotnet build --configuration Release
           
      - name: dotnet test
        run: |
          dotnet test --no-build --no-restore --verbosity normal --configuration Release             

      - name: dotnet publish
        run: |
          dotnet publish -c Release -o './App_Data/Jobs/Continuous/${{ env.WEBJOB1_NAME }}'
     
        
      - name: Deploy to Azure App Service
        uses: azure/webapps-deploy@v2
        with: 
          app-name: ACCOUNT-DEV
          publish-profile: ${{ secrets.PUBLISH_PROFILE_DEV }}
          package: '.'


  product-dev-release:
    name: Release product to DEV
    runs-on: ubuntu-latest
    environment: PRODUCT-DEV
    steps:
      # Checkout the repo
      - uses: actions/checkout@v2

      # Setup .NET Core SDK
      - name: Setup .NET Core
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: ${{ env.DOTNET_VERSION }}
        
      - name: Build with dotnet        
        run: |
          dotnet build --configuration Release
           
      - name: dotnet test
        run: |
          dotnet test --no-build --no-restore --verbosity normal --configuration Release 

      - name: dotnet publish
        run: |
          dotnet publish -c Release -o './App_Data/Jobs/Continuous/${{ env.WEBJOB2_NAME }}'     
        
      - name: Deploy to Azure App Service
        uses: azure/webapps-deploy@v2
        with: 
          app-name: ACCOUNT-DEV
          publish-profile: ${{ secrets.PUBLISH_PROFILE_DEV }}
          package: '.'

Any suggestions please?

torek
  • 448,244
  • 59
  • 642
  • 775
ashima
  • 11
  • 2
  • *Git* isn't a deployment tool; as such, Git does not do deployments. Azure and other "ecosystem" setups often provide various add-ons to do deployments but if that's what you're looking for, it's not a Git question, it's just an Azure question. – torek Feb 01 '22 at 08:22

1 Answers1

0
  1. Associate your webjobs with the web app, In Visual Studio right click your Web App project and select Add > Existing Project as Azure WebJob

  2. After the webjobs are included in the web app package.

  3. Deploy web app to azure app service.

  4. It will generate packages for webjobs during publishing into azure. You need to specify the web app package in Azure App Service deploy task. Refer here for Steps

Add your project into the GIT repository and configure it with azure for continuous Deployment

Refer Deploy multiple web jobs via git for more information

Delliganesh Sevanesan
  • 4,146
  • 1
  • 5
  • 15