name: Build and deploy to Azure Web App - MyProjectDev on: push: branches: - main workflow_dispatch: env: AZURE_WEBAPP_NAME: MyProjectDev DOTNET_VERSION: '8.0.x' PROJECT_PATH: './MyProject.Web' AZURE_PUBLISH_URL: 'url' AZURE_WEBAPP_PACKAGE_PATH: './publish' jobs: build: runs-on: ubuntu-latest steps: # Step 1: Checkout code from the repository - uses: actions/checkout@v4 # Step 2: Set up .NET Core SDK (version 8.0) - name: Setup .NET Core SDK uses: actions/setup-dotnet@v3 with: dotnet-version: ${{ env.DOTNET_VERSION }} # Step 3: Build the entire solution (includes dependencies) - name: Build the solution run: | dotnet restore dotnet build --configuration Release # Step 4: Publish only the Web Project (FarmstandFinder.Web) - name: Publish the Web Project run: | dotnet publish ${{ env.PROJECT_PATH }} -c Release -o '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}' # Step 5: Zip the published output (similar to Visual Studio's ZipDeploy) - name: Zip the output folder run: | cd '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}' zip -r ../app.zip . # Step 6: Deploy the zipped package to Azure Web App using ZipDeploy - name: Deploy to Azure Web App uses: azure/webapps-deploy@v3 with: app-name: ${{ env.AZURE_WEBAPP_NAME }} publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} package: './app.zip'