Skip to content

Update azure-static-web-apps-black-sand-06df6ac0f.yml #11

Update azure-static-web-apps-black-sand-06df6ac0f.yml

Update azure-static-web-apps-black-sand-06df6ac0f.yml #11

name: Build and deploy ASP.Net Core app to Azure Web App
on:
push:
branches: [dev]
pull_request:
branches: [main]
env:
AZURE_WEBAPP_NAME: mango-entertainment-dev-api
DOTNET_VERSION: '8.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: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
slot-name: 'Production'
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_1140C5145B254A12A68F8D7CAFFB1095 }}
package: .