name: Build and deploy .NET Core application to Web App AntDesignDocsWebApp on: push: branches: - master env: AZURE_WEBAPP_NAME: AntDesignDocsWebApp AZURE_WEBAPP_PACKAGE_PATH: site/AntDesign.Docs.WebApp/published WORKING_DIRECTORY: site/AntDesign.Docs.WebApp jobs: build: runs-on: ubuntu-latest if: github.repository_owner == 'ant-design-blazor' steps: - uses: actions/checkout@v4 - name: Setup .NET Core 3.1 uses: actions/setup-dotnet@v3 with: dotnet-version: 3.1.300 - name: Setup .NET Core 5.0 uses: actions/setup-dotnet@v3 with: dotnet-version: 5.0.100 - name: Setup .NET 6.0 uses: actions/setup-dotnet@v3 with: dotnet-version: 6.0.101 - name: Setup .NET 7.0 uses: actions/setup-dotnet@v3 with: dotnet-version: 7.0.100 - name: Setup .NET 8.0 uses: actions/setup-dotnet@v3 with: dotnet-version: 8.0.x - uses: actions/setup-node@v1 with: node-version: "16.x" - name: Restore run: dotnet restore - name: Build run: | npm install dotnet build - name: Test run: dotnet test "${{ env.WORKING_DIRECTORY }}" - name: Publish run: dotnet publish "${{ env.WORKING_DIRECTORY }}" --configuration Release --output "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}" - name: Publish Artifacts uses: actions/upload-artifact@v3 with: name: webapp path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} deploy: runs-on: ubuntu-latest needs: build steps: - name: Download artifact from build job uses: actions/download-artifact@v3 with: name: webapp path: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} - name: Deploy to Azure WebApp uses: azure/webapps-deploy@v2 with: app-name: ${{ env.AZURE_WEBAPP_NAME }} publish-profile: ${{ secrets.AntDesignDocsWebApp_6BBA }} package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}