Skip to content

Update main_mango-entertainment-api.yml #8

Update main_mango-entertainment-api.yml

Update main_mango-entertainment-api.yml #8

name: Build and deploy ASP.Net Core app to Azure Web App - Production
on:
push:
branches:
- main
workflow_dispatch:
env:
AZURE_WEBAPP_NAME: mango-entertainment-api
DOTNET_VERSION: '8.0.x'
WORKING_DIRECTORY: ./base-api
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore Dependencies
run: dotnet restore
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: Build with dotnet
run: dotnet build --configuration Release --no-restore
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: Publish
run: dotnet publish -c Release -o ${{github.workspace}}/publish
working-directory: ${{ env.WORKING_DIRECTORY }}
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: .net-app
path: ${{github.workspace}}/publish
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: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
package: .
- name: logout
run: |
az logout