chore(deps): bump actions/setup-dotnet from 4 to 5 #58
This file contains hidden or 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: Build, Test, and Deploy to Azure | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'src/LogisticsAPI/**' | |
| - 'tests/**' | |
| - '*.sln' | |
| - '.github/workflows/azure-deploy.yml' | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - 'src/LogisticsAPI/**' | |
| - 'tests/**' | |
| - '*.sln' | |
| - '.github/workflows/azure-deploy.yml' | |
| workflow_dispatch: | |
| concurrency: | |
| group: api-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| AZURE_WEBAPP_NAME: logistics-inventory-api-abdallah | |
| AZURE_WEBAPP_PACKAGE_PATH: './publish' | |
| DOTNET_VERSION: '8.0.x' | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Restore dependencies | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --configuration Release --no-restore | |
| - name: Run tests | |
| run: dotnet test --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" | |
| - name: Publish API | |
| run: dotnet publish src/LogisticsAPI/LogisticsAPI.csproj --configuration Release --output ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: webapp | |
| path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} | |
| deploy: | |
| needs: build-and-test | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') | |
| environment: | |
| name: production | |
| url: ${{ steps.deploy.outputs.webapp-url }} | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: webapp | |
| path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} | |
| - name: Deploy to Azure Web App | |
| id: deploy | |
| uses: azure/webapps-deploy@v3 | |
| with: | |
| app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
| publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
| package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} |