Add or update the Azure App Service build and deployment workflow config #18
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: ScriptedSky CI | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| AZURE_WEBAPP_NAME: scriptedSky-webapi | |
| DOTNET_VERSION: '9.x' | |
| SOLUTION_PATH: 'ScriptedSkyAPI.sln' | |
| API_PROJECT_PATH: 'API' | |
| PUBLISH_DIR: ${{ github.workspace }}/publish | |
| jobs: | |
| build-and-test: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Restore | |
| run: dotnet restore ${{ env.SOLUTION_PATH }} | |
| - name: Build | |
| run: dotnet build ${{ env.SOLUTION_PATH }} --configuration Release --no-restore | |
| - name: Publish API project | |
| run: dotnet publish ${{ env.API_PROJECT_PATH }} --configuration Release --no-restore --no-build --property:PublishDir=${{ env.PUBLISH_DIR }} | |
| - name: Show publish directory content | |
| run: dir ${{ env.PUBLISH_DIR }} | |
| - name: Publish Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: webapp | |
| path: ${{ env.PUBLISH_DIR }} | |
| deploy: | |
| runs-on: windows-latest | |
| needs: [build-and-test] | |
| steps: | |
| - name: Download artifact from build job | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: webapp | |
| path: ${{ env.PUBLISH_DIR }} | |
| - name: Deploy | |
| uses: azure/webapps-deploy@v2 | |
| with: | |
| app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
| publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
| package: '${{ env.PUBLISH_DIR }}' |