|
| 1 | +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy |
| 2 | +# More GitHub Actions for Azure: https://github.com/Azure/actions |
| 3 | + |
| 4 | +name: Build and deploy ASP.Net Core app to Azure Web App - Wrap-Studio |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +env: |
| 13 | + WEBAPP_NAME: Wrap-Studio |
| 14 | + WEB_PROJECT: FilmProductionManagementSystem/Wrap.FilmProductionManagementSystem.Web/Wrap.FilmProductionManagementSystem.Web.csproj |
| 15 | + PUBLISH_DIR: ${{ github.workspace }}/publish |
| 16 | + PACKAGE_ZIP: ${{ github.workspace }}/app.zip |
| 17 | + |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + runs-on: windows-latest |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Set up .NET |
| 25 | + uses: actions/setup-dotnet@v4 |
| 26 | + with: |
| 27 | + dotnet-version: "8.x" |
| 28 | + |
| 29 | + - name: Restore |
| 30 | + run: dotnet restore "${{ env.WEB_PROJECT }}" |
| 31 | + |
| 32 | + - name: Publish |
| 33 | + run: dotnet publish "${{ env.WEB_PROJECT }}" -c Release -o "${{ env.PUBLISH_DIR }}" |
| 34 | + |
| 35 | + - name: Zip publish output |
| 36 | + shell: pwsh |
| 37 | + run: | |
| 38 | + if (Test-Path "${{ env.PACKAGE_ZIP }}") { Remove-Item "${{ env.PACKAGE_ZIP }}" -Force } |
| 39 | + Compress-Archive -Path "${{ env.PUBLISH_DIR }}\*" -DestinationPath "${{ env.PACKAGE_ZIP }}" |
| 40 | +
|
| 41 | + - name: Upload artifact for deploy job |
| 42 | + uses: actions/upload-artifact@v4 |
| 43 | + with: |
| 44 | + name: webapp |
| 45 | + path: ${{ env.PACKAGE_ZIP }} |
| 46 | + |
| 47 | + deploy: |
| 48 | + runs-on: windows-latest |
| 49 | + needs: build |
| 50 | + permissions: |
| 51 | + id-token: write |
| 52 | + contents: read |
| 53 | + steps: |
| 54 | + - name: Download artifact |
| 55 | + uses: actions/download-artifact@v4 |
| 56 | + with: |
| 57 | + name: webapp |
| 58 | + path: . |
| 59 | + |
| 60 | + - name: Login to Azure |
| 61 | + uses: azure/login@v2 |
| 62 | + with: |
| 63 | + client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_81518D501E064914A73D3928C48694FB }} |
| 64 | + tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_BF676D243FB8453D94A645550361FD9C }} |
| 65 | + subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_C8131597CB3F401AA60F79FC004EF7F9 }} |
| 66 | + |
| 67 | + - name: Deploy to Azure Web App |
| 68 | + uses: azure/webapps-deploy@v3 |
| 69 | + with: |
| 70 | + app-name: ${{ env.WEBAPP_NAME }} |
| 71 | + package: app.zip |
| 72 | + |
0 commit comments