codeflash-internal/.github/workflows/deploy_cfwebapp_to_azure.yml
Kevin Turcios ea60289699 fix: hoist pnpm deps and deploy to codeflash-webapp-main
Add node-linker=hoisted to .npmrc so pnpm hoists all dependencies like
npm. Update CI to rsync workspace-root node_modules into cf-webapp
before zipping, ensuring @next/env, @swc/helpers, and other peer deps
are included. Retarget deployment to the new codeflash-webapp-main app.
2026-04-15 07:04:41 -05:00

118 lines
3.8 KiB
YAML

name: Deploy CF-WEB-APP to Azure App Service
on:
push:
branches:
- main
paths:
- "js/cf-webapp/**"
- ".github/workflows/deploy_cfwebapp_to_azure.yml"
workflow_dispatch:
jobs:
build:
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
REDIS_URL: ${{ secrets.REDIS_URL }}
AUTH0_ISSUER_BASE_URL: ${{ secrets.AUTH0_ISSUER_BASE_URL }}
AUTH0_CLIENT_ID: ${{ secrets.AUTH0_CLIENT_ID }}
AUTH0_CLIENT_SECRET: ${{ secrets.AUTH0_CLIENT_SECRET }}
AUTH0_SECRET: ${{ secrets.AUTH0_SECRET }}
AUTH0_BASE_URL: ${{ secrets.AUTH0_BASE_URL }}
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
steps:
- uses: actions/checkout@v6
- name: Setup Node.js environment
uses: actions/setup-node@v6
with:
node-version: "20"
registry-url: https://npm.pkg.github.com
scope: "@codeflash-ai"
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Restore WASM artifacts cache
uses: actions/cache@v5
with:
path: |
js/cf-webapp/public/web-tree-sitter.wasm
js/cf-webapp/public/tree-sitter-python.wasm
js/cf-webapp/public/.tree-sitter-python-version
key: wasm-${{ runner.os }}-${{ hashFiles('js/pnpm-lock.yaml') }}
- name: Install dependencies
working-directory: js
run: pnpm install --frozen-lockfile
- name: Restore Next.js build cache
uses: actions/cache@v5
with:
path: js/cf-webapp/.next/cache
key: nextjs-${{ runner.os }}-${{ hashFiles('js/pnpm-lock.yaml') }}-${{ hashFiles('js/cf-webapp/src/**') }}
restore-keys: |
nextjs-${{ runner.os }}-${{ hashFiles('js/pnpm-lock.yaml') }}-
nextjs-${{ runner.os }}-
- name: Build common package
working-directory: js
run: pnpm --filter @codeflash-ai/common build
- name: Build and package app
working-directory: js
run: |
pnpm --filter codeflash-webapp build
# pnpm hoists shared deps to the workspace root node_modules/.
# Merge them into cf-webapp/node_modules/ so the zip is self-contained.
rsync -a --ignore-existing node_modules/ cf-webapp/node_modules/
cd cf-webapp && zip -qr cfwebapp.zip . .next node_modules package.json public
- name: Upload artifact for deployment jobs
uses: actions/upload-artifact@v7
with:
name: cfwebapp-artifact
path: js/cf-webapp/cfwebapp.zip
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: "dev"
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write #This is required for requesting the JWT
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v8
with:
name: cfwebapp-artifact
- name: Unzip artifact for deployment
run: unzip cfwebapp.zip
- name: Login to Azure
uses: azure/login@v3
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: "Deploy to Azure App Service - codeflash-webapp-main"
uses: azure/webapps-deploy@v3
id: deploy-to-webapp
with:
app-name: "codeflash-webapp-main"
# if we deploy a zip we can do Run-From-Zip and skip the oryx build step (which fails if we do a regular zip-deploy because it thinks the project is php for some reason)
# https://learn.microsoft.com/en-us/azure/app-service/deploy-run-package#enable-running-from-package
package: "cfwebapp.zip"
clean: true