Skip to content

update appsettings

update appsettings #4

name: Build and deploy .NET API app to Azure Web App
on:
push:
branches:
- main # Trigger on commits to the main branch
workflow_dispatch:
env:
DOTNET_VERSION: '8.x' # .NET SDK version to use
BUILD_CONFIGURATION: 'Release' # Build configuration
AZURE_WEBAPP_NAME: 'AuthAPI22' # Your Azure Web App name
AZURE_WEBAPP_PUBLISH_PROFILE: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} # Azure publish profile secret
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore .NET dependencies
run: dotnet restore Auth.API/Auth.API.csproj
- name: Build .NET project
run: dotnet build Auth.API/Auth.API.csproj --configuration ${{ env.BUILD_CONFIGURATION }}
- name: Run unit tests
run: dotnet test Auth.API/Auth.API.csproj --configuration ${{ env.BUILD_CONFIGURATION }} --no-build --verbosity normal
- name: Publish .NET project
run: dotnet publish Auth.API/Auth.API.csproj --configuration ${{ env.BUILD_CONFIGURATION }} --output ${{ github.workspace }}/publish
- name: List published files
run: ls -R ${{ github.workspace }}/publish
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: dotnet-api
path: publish/
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: dotnet-api
path: download/
- name: List files in artifact
run: ls -R download/
- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
package: download/