name: Azure Web App CI/CD on: push: branches: - main jobs: build_and_deploy: runs-on: ubuntu-latest name: Build And Deploy steps: - uses: actions/checkout@v3 - name: Set up Node uses: actions/setup-node@v4 with: node-version: "20" - name: Build frontend working-directory: frontend run: | npm ci npm run build # Backend's app/ package expects frontend/dist at /frontend/dist when running # locally or on HF (see FRONTEND_DIST in backend/app/main.py); FRONTEND_DIST_DIR (set on the # Web App) overrides that for this deploy layout, where backend/'s contents are flattened to # the package root so Oryx's build step finds requirements.txt where it expects. - name: Assemble deploy package run: | mkdir -p deploy_package cp -r backend/. deploy_package/ rm -rf deploy_package/.venv deploy_package/__pycache__ find deploy_package -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true mkdir -p deploy_package/frontend cp -r frontend/dist deploy_package/frontend/dist - name: Zip deploy package run: cd deploy_package && zip -r -q ../deploy_package.zip . # azure/webapps-deploy (both v2 and v3) failed on this app with "Publish profile is invalid # for app-name and slot-name provided" / "Failed to get app runtime OS" — it tries an ARM # call a bare publish profile can't satisfy. az CLI (authenticated via a scoped service # principal) is the same mechanism that already deploys reliably from a local shell. - name: Azure login uses: azure/login@v2 with: creds: ${{ secrets.AZURE_CREDENTIALS }} - name: Deploy to Azure Web App run: | az webapp deployment source config-zip \ --name revenue-crm-webapp \ --resource-group revenue-crm-plan-grp \ --src deploy_package.zip