update deploy script

This commit is contained in:
Nate Kelley 2025-09-06 09:18:30 -06:00
parent 2c06dbc6de
commit db2d3e7d09
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
7 changed files with 201 additions and 74 deletions

116
.github/workflows/deploy-web-staging.yml vendored Normal file
View File

@ -0,0 +1,116 @@
name: Deploy Web to Staging
on:
push:
branches:
- staging
paths:
- "apps/web/**"
workflow_dispatch:
# Cancel in-progress deployments when a new commit is pushed
concurrency:
group: deploy-web-staging-${{ github.ref }}
cancel-in-progress: true
env:
CI: true
jobs:
deploy:
name: Deploy to Staging
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 30
environment: staging
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9.15.0
- name: Setup Node.js
uses: useblacksmith/setup-node@v5
with:
node-version: 22
cache: 'pnpm'
- name: Cache node_modules
uses: actions/cache@v4
with:
path: |
node_modules
apps/web/node_modules
key: pnpm-web-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('apps/web/package.json') }}
restore-keys: |
pnpm-web-${{ hashFiles('pnpm-lock.yaml') }}-
pnpm-web-
- name: Cache Turbo
uses: actions/cache@v4
with:
path: .turbo
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ github.ref_name }}-
turbo-${{ github.job }}-
- name: Install dependencies
run: pnpm install --frozen-lockfile --filter=@buster-app/web
- name: Build required packages
run: pnpm build --filter=@buster-app/web
env:
NODE_ENV: production
NODE_OPTIONS: --max-old-space-size=8192
TURBO_CACHE_DIR: .turbo
TURBO_TELEMETRY_DISABLED: 1
- name: Deploy to Cloudflare Workers
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: deploy .output/server/index.mjs --env staging --assets .output/public
workingDirectory: apps/web
env:
NODE_ENV: production
- name: Get commit info
id: commit
run: |
echo "sha_short=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT
echo "sha_full=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Create deployment summary
if: success()
run: |
SHA="${{ steps.commit.outputs.sha_short }}"
echo "## 🎉 Web Staging Deployment Successful!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **Environment:** \`staging\`" >> $GITHUB_STEP_SUMMARY
echo "- **URL:** https://staging.buster.so" >> $GITHUB_STEP_SUMMARY
echo "- **Worker:** \`web-staging\`" >> $GITHUB_STEP_SUMMARY
echo "- **Branch:** \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY
echo "- **Commit:** \`${SHA}\`" >> $GITHUB_STEP_SUMMARY
echo "- **Full SHA:** \`${{ steps.commit.outputs.sha_full }}\`" >> $GITHUB_STEP_SUMMARY
echo "- **Triggered by:** ${{ github.actor }}" >> $GITHUB_STEP_SUMMARY
echo "- **Time:** $(date -u +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY
- name: Handle deployment failure
if: failure()
run: |
echo "## ❌ Web Staging Deployment Failed!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **Environment:** \`staging\`" >> $GITHUB_STEP_SUMMARY
echo "- **Error:** Check the logs above for details" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Next Steps:" >> $GITHUB_STEP_SUMMARY
echo "1. Review the error logs above" >> $GITHUB_STEP_SUMMARY
echo "2. Check Cloudflare dashboard for deployment status" >> $GITHUB_STEP_SUMMARY
echo "3. Verify GitHub secrets are configured correctly" >> $GITHUB_STEP_SUMMARY
echo "4. Verify staging environment variables in GitHub Secrets" >> $GITHUB_STEP_SUMMARY

1
.gitignore vendored
View File

@ -93,4 +93,3 @@ drizzle/meta/
apps/web/.env.prod
apps/web/.env.production
apps/web/.env.staging
apps/web/wrangler.jsonc

1
apps/web/.gitignore vendored
View File

@ -18,4 +18,3 @@ storybook-static
.env.staging
.env.dev
.env.local
wrangler.jsonc

View File

@ -2,25 +2,25 @@
const WARNING_SUPPRESSIONS = {
MODULE_LEVEL_DIRECTIVE: {
patterns: ["node_modules/"],
reason: "Suppress 'use client' directive warnings from dependencies"
reason: "Suppress 'use client' directive warnings from dependencies",
},
THIS_IS_UNDEFINED: {
patterns: ["node_modules/"],
reason: "Suppress 'this' keyword warnings in ES modules from dependencies"
reason: "Suppress 'this' keyword warnings in ES modules from dependencies",
},
CIRCULAR_DEPENDENCY: {
patterns: [
"nitropack/dist/runtime/internal/",
"@tanstack/store/dist",
"juice/lib/"
"juice/lib/",
],
reason: "Suppress known third-party circular dependency warnings"
}
reason: "Suppress known third-party circular dependency warnings",
},
};
// Additional message-based suppressions
const MESSAGE_SUPPRESSIONS = [
"The 'this' keyword is equivalent to 'undefined'"
"The 'this' keyword is equivalent to 'undefined'",
];
function shouldSuppressWarning(warning) {
@ -29,27 +29,24 @@ function shouldSuppressWarning(warning) {
// Check code-based suppressions
const suppression = WARNING_SUPPRESSIONS[warning.code];
if (suppression) {
return suppression.patterns.some(pattern => message.includes(pattern));
return suppression.patterns.some((pattern) => message.includes(pattern));
}
// Check message-based suppressions
return MESSAGE_SUPPRESSIONS.some(suppressionMessage =>
return MESSAGE_SUPPRESSIONS.some((suppressionMessage) =>
message.includes(suppressionMessage)
);
}
export default {
// rollupConfig: {
// onwarn(warning, defaultHandler) {
// if (shouldSuppressWarning(warning)) {
// return;
// }
rollupConfig: {
onwarn(warning, defaultHandler) {
if (shouldSuppressWarning(warning)) {
return;
}
// // Handle all other warnings normally
// defaultHandler(warning);
// },
// onerror: (id) => {
// console.error(`Big nate: Error in ${id}`);
// },
// },
// Handle all other warnings normally
defaultHandler(warning);
},
},
};

View File

@ -8,8 +8,6 @@
"build": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build -- --typecheck",
"build:staging": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build --mode staging",
"build:production": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build --mode production -- --typecheck",
"build:cloudflare": "cross-env NODE_OPTIONS=\"--max-old-space-size=8192 --max-semi-space-size=256\" TYPECHECK=false vite build --mode production",
"build:cf-optimized": "cross-env NODE_OPTIONS=\"--max-old-space-size=7680 --optimize-for-size\" TYPECHECK=false vite build --mode production",
"build:local": "cross-env NODE_OPTIONS=--max-old-space-size=12288 vite build -- --typecheck --local",
"build-storybook": "storybook build",
"build:visualize": "npx vite-bundle-visualizer",

View File

@ -1,47 +0,0 @@
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "web",
"main": "./.output/server/index.mjs",
"compatibility_date": "2025-09-02", //Happy birthday to Nate 🎉
"compatibility_flags": ["nodejs_compat", "no_nodejs_compat_v2"],
"assets": {
"directory": ".output/public"
},
"observability": {
"enabled": true
},
"env": {
// Development Environment
"dev": {
"name": "web-dev",
"vars": {
// Development-specific variables can be set here
// Or loaded from .env.dev file
}
},
// Staging Environment
"staging": {
"name": "web-staging",
"routes": [],
"vars": {
// Staging-specific variables can be set here
// Or loaded from .env.staging file
}
},
// Production Environment
"production": {
"name": "web-production",
"routes": [],
"vars": {
// Production-specific variables can be set here
// Or loaded from .env.production file
}
}
}
}

65
apps/web/wrangler.jsonc Normal file
View File

@ -0,0 +1,65 @@
{
"$schema": "node_modules/wrangler/config-schema.json",
"name": "web",
"main": "./.output/server/index.mjs",
"compatibility_date": "2024-09-04",
"compatibility_flags": ["nodejs_compat"],
"assets": {
"directory": ".output/public"
},
"observability": {
"enabled": true
},
"env": {
// Development Environment
"dev": {
"name": "web-dev",
"vars": {
// Development-specific variables can be set here
// Or loaded from .env.dev file
}
},
// Staging Environment
"staging": {
"name": "web-staging",
"routes": [
{
"pattern": "staging.buster.so",
"custom_domain": true
}
],
"vars": {
"VITE_PUBLIC_API_URL": "https://api2staging.buster.so",
"VITE_PUBLIC_URL": "https://staging.buster.so",
"VITE_PUBLIC_SUPABASE_URL": "https://vlelrtlxoixvaynaudau.supabase.co",
"VITE_PUBLIC_SUPABASE_ANON_KEY": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZsZWxydGx4b2l4dmF5bmF1ZGF1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjM3MzEyNzgsImV4cCI6MjAzOTMwNzI3OH0.nK2gZggez6r_F00Ci_fcMXPle5HWo9boGQ5mG3CERFs",
"VITE_PUBLIC_POSTHOG_KEY": "phc_CtxCFcicGmtdan7MnQTRc3AypAifI7FYsoVFv3WnCQc",
"VITE_PUBLIC_API2_URL": "https://stagingapi.buster.so",
"VITE_PUBLIC_ENABLE_TANSTACK_PANEL": "true"
}
},
// Production Environment
"production": {
"name": "web-production",
"routes": [
{
"pattern": "app.buster.so",
"custom_domain": true
}
],
"vars": {
"VITE_PUBLIC_API_URL": "https://api.buster.so",
"VITE_PUBLIC_URL": "https://platform.buster.so",
"VITE_PUBLIC_SUPABASE_URL": "https://aofftppzkoydkyfrhrcj.supabase.co",
"VITE_PUBLIC_SUPABASE_ANON_KEY": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImFvZmZ0cHB6a295ZGt5ZnJocmNqIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjYzNTUzNDUsImV4cCI6MjA0MTkzMTM0NX0.sg_4VkZDpVDO51bMBsAOhNdU_AAXnH8bGqeK3UHHe-Q",
"VITE_PUBLIC_POSTHOG_KEY": "phc_CtxCFcicGmtdan7MnQTRc3AypAifI7FYsoVFv3WnCQc",
"VITE_PUBLIC_API2_URL": "https://api2.buster.so"
}
}
}
}