build(deps): bump Microsoft.NET.Test.Sdk from 17.10.0 to 17.11.1 #46
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Azure Web App CI/CD | |
on: | |
push: | |
branches: ['main'] | |
pull_request: | |
types: [opened, synchronize, reopened] | |
branches: ['main'] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pull-requests: write | |
env: | |
DOTNET_VERSION: '8.x' | |
APP_PROJECT_FILE: './src/App/VictorFrye.MicrosoftGraveyard.csproj' | |
APP_OUTPUT_LOCATION: './publish' | |
APP_ARTIFACT_NAME: 'app-${{ github.sha }}' | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
lfs: false | |
- name: Set Up .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Restore Dependencies | |
run: dotnet restore | |
- name: Verify Formatting | |
run: dotnet format --verify-no-changes --no-restore | |
- name: Build Solution | |
run: dotnet build -c Release --no-restore | |
- name: Run Tests | |
run: dotnet test -c Release --no-restore | |
- name: Publish App | |
if: github.event_name == 'push' | |
run: dotnet publish ${{ env.APP_PROJECT_FILE }} -c Release -o ${{ env.APP_OUTPUT_LOCATION }} --no-restore --no-build | |
- name: Upload artifact | |
if: github.event_name == 'push' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.APP_ARTIFACT_NAME }} | |
path: ${{ env.APP_OUTPUT_LOCATION }} | |
deploy: | |
name: Deploy | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
needs: build | |
environment: | |
name: ${{ github.event_name == 'push' && 'Production' || 'Staging' }} | |
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
id-token: write #This is required for requesting the JWT | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ env.APP_ARTIFACT_NAME }} | |
- name: Login to Azure | |
uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_B10F9536C9604999BE46D429A3A0EE71 }} | |
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_1B2309EB296D44398AC10982BFCF78DF }} | |
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_8BFE9FC514354166A744F0E6341A96A4 }} | |
- name: Deploy Azure Web App | |
id: deploy-to-webapp | |
uses: azure/webapps-deploy@v3 | |
with: | |
app-name: 'app-graveyard' | |
slot-name: 'Production' | |
package: . | |
clean: true |