How do I deploy a simple C# Console App using Github Actions using Azure?

Anonymous
2022-05-30T01:25:23.82+00:00

I am trying to get a better idea regards to deploying a simple C# Console application with Github Actions (and possibly to Azure App Service).

I got a recommendation to use Azure App Service because it is a simple application (that pulls data from a third party API and insert data into Azure SQL).

I also understood that I cannot use WebJobs if I use Github.

I realized that I do not need to have a Web site since this is a Console application deployment.

My first question is why do I even have this option (https://..) here?

206531-image.png

My second question is if I want to deploy a simple C# Console Application using Github Actions (and not using VM), is Azure App Service the better option?

Azure App Configuration
Azure App Configuration
An Azure service that provides hosted, universal storage for Azure app configurations.
237 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,880 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sudipta Chakraborty - MSFT 1,111 Reputation points Microsoft Employee
    2022-05-30T04:02:43.437+00:00

    @KingJava :

    You can try the below mentioned YML script which uses publish profile details of web app. to deploy. Setup the publish profile as a secret and your done.
    The script is deploying when "Triggered". If you have a continuous job change that folder to "Continuous".

    References:
    https://learn.microsoft.com/en-us/azure/app-service/deploy-github-actions?tabs=userlevel#configure-the-github-secret

    https://github.com/Azure/webapps-deploy/issues/3

    name: Deploy WebJob  
      
    on:  
      workflow_dispatch:  
      
      push:  
        branches: [ develop ]  
      
    env:  
      WEBJOB_NAME: YourWebJobName  
      AZURE_APP_NAME: your-azure-app-service-name  
      PROJECT_ROOT: path/to/your/Project.Root  
      TEST_PROJECT_ROOT: path/to/your/Project.Root.Tests  
      DOTNET_VERSION: '3.1.x'  
      
    jobs:  
      build:  
        runs-on: ubuntu-latest  
      
        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: dotnet test  
          run: |  
            dotnet test ${{ env.TEST_PROJECT_ROOT }}  
      
        - name: dotnet publish  
          run: |  
            dotnet publish -c Release -o './publish/App_Data/Jobs/Triggered/${{ env.WEBJOB_NAME }}' ${{ env.PROJECT_ROOT }}  
      
        - name: Deploy to Azure App Service  
          uses: azure/webapps-deploy@v2  
          with:   
            app-name: ${{ env.AZURE_APP_NAME }}  
            publish-profile: ${{ secrets.PUBLISH_PROFILE }}  
            package: './publish'  
    
    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.