Upgrade azure/k8s-set-context to v5.0.0 #451
Workflow file for this run
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: AIForOrcas.Server | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: # Allow manual workflow invocation from the Github Actions UI | |
| env: | |
| DOTNET_VERSION: 6.0.x | |
| DOTNET_RUNTIME: win-x86 | |
| WORKING_DIR: ModeratorFrontEnd/AIForOrcas/AIForOrcas.Server | |
| PUBLISH_DIR: output | |
| AZURE_APP_NAME: AIForOrcasDetections | |
| defaults: | |
| run: | |
| working-directory: ModeratorFrontEnd/AIForOrcas/AIForOrcas.Server | |
| permissions: # added using https://github.com/step-security/secure-repo | |
| contents: read | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| outputs: | |
| src: ${{ steps.filter.outputs.src }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Check for file changes | |
| uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 | |
| id: filter | |
| with: | |
| filters: | | |
| src: | |
| - ModeratorFrontEnd/AIForOrcas/AIForOrcas.Server/** | |
| - ModeratorFrontEnd/AIForOrcas/AIForOrcas.Server.BL/** | |
| - ModeratorFrontEnd/AIForOrcas/AIForOrcas.DTO/** | |
| - .github/workflows/AIForOrcas.Server.yaml | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: changes | |
| if: ${{ needs.changes.outputs.src == 'true' }} | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Setup .NET Core | |
| uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Dependencies | |
| run: dotnet restore -r ${{ env.DOTNET_RUNTIME }} | |
| - name: Build | |
| run: dotnet build --no-restore -c Release -r ${{ env.DOTNET_RUNTIME }} | |
| - name: Test | |
| run: dotnet test --no-restore -r ${{ env.DOTNET_RUNTIME }} | |
| - name: Publish | |
| run: dotnet publish --no-restore -c Release -o './${{ env.PUBLISH_DIR }}' | |
| - name: Artifacts cache | |
| uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | |
| with: | |
| path: ./${{ env.WORKING_DIR }}/${{ env.PUBLISH_DIR }} | |
| key: ${{ github.sha }}-${{ env.AZURE_APP_NAME }}-${{ env.DOTNET_RUNTIME }}-artifacts | |
| deploy: | |
| if: github.ref == 'refs/heads/main' && needs.changes.outputs.src == 'true' | |
| runs-on: ubuntu-latest | |
| needs: | |
| - changes | |
| - build | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d # v2.16.1 | |
| with: | |
| egress-policy: audit | |
| - name: Artifacts cache | |
| uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 | |
| with: | |
| path: ./${{ env.WORKING_DIR}}/${{ env.PUBLISH_DIR }} | |
| key: ${{ github.sha }}-${{ env.AZURE_APP_NAME }}-${{ env.DOTNET_RUNTIME }}-artifacts | |
| - name: Deploy to azure | |
| uses: azure/webapps-deploy@02a81bead70021f5284939794bcec79c271ab383 # v3.0.8 | |
| with: | |
| app-name: ${{ env.AZURE_APP_NAME }} | |
| publish-profile: ${{ secrets.AZURE_AISFORORCASDETECTIONS_PUBLISH_PROFILE }} | |
| package: ./${{ env.WORKING_DIR }}/${{ env.PUBLISH_DIR }} |