flow new try2 #3
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 | |
| permissions: | |
| contents: read #This is required for actions/checkout | |
| 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] | |
| permissions: | |
| id-token: write #This is required for requesting the JWT | |
| contents: read #This is required for actions/checkout | |
| steps: | |
| - name: Download artifact from build job | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: webapp | |
| path: ${{ env.PUBLISH_DIR }} | |
| - name: Login to Azure | |
| uses: azure/login@v2 | |
| with: | |
| client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_E79BCB993D384D578550C40F52E35F8E }} | |
| tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_DE046D03466C4CDF9DE5D3FB0ED49CB7 }} | |
| subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_1CB7E1DA32964F84B1CCBFA1BAD5DE03 }} | |
| - name: Deploy | |
| uses: azure/webapps-deploy@v2 | |
| with: | |
| app-name: '${{ env.AZURE_WEBAPP_NAME }}' | |
| package: '${{ env.PUBLISH_DIR }}' |