Open source alternative to Semrush and Ahrefs
TypeScript backlink-analysisgoogle-search-console-mcpkeyword-researchmcpseoseo-agentseo-auditseo-automationseo-skillsseo-toolssite-audit
Add a Deploy website workflow and pnpm deploy:web (#1037)
Ben Senescua02e4321987c
diff --git a/.github/workflows/deploy-website.yml b/.github/workflows/deploy-website.ymlnew file mode 100644index 00000000..ddaf3cbf--- /dev/null+++ b/.github/workflows/deploy-website.yml@@ -0,0 +1,84 @@+name: Deploy website++# Deploys web/ (the openseo.so marketing site, worker `open-seo-landing`).+# Maintainer setup: docs/maintainers/production-deployment.md+on:+ push:+ branches: [main]+ paths:+ - web/**+ - .github/workflows/deploy-website.yml+ workflow_dispatch:++permissions:+ contents: read++# Never interrupt a wrangler upload; a newer push queues behind it.+concurrency:+ group: deploy-website+ cancel-in-progress: false++jobs:+ deploy:+ # The public mirror must not deploy. Only main may use the production+ # environment's credentials.+ if: github.repository == 'bensenescu/open-seo' && github.ref == 'refs/heads/main'+ runs-on: ubuntu-latest+ timeout-minutes: 15+ environment:+ name: production+ url: https://openseo.so+ defaults:+ run:+ working-directory: web++ steps:+ - name: Checkout+ uses: actions/checkout@v4+ with:+ ref: ${{ github.sha }}+ persist-credentials: false++ - name: Validate website configuration+ shell: bash+ env:+ CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}+ CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}+ VITE_TURNSTILE_SITE_KEY: ${{ vars.WEBSITE_TURNSTILE_SITE_KEY }}+ run: |+ # The site key is inlined by vite build; the worker's runtime secrets+ # (TURNSTILE_SECRET_KEY, DATAFORSEO_API_KEY, ...) are set once with+ # `wrangler secret put` and survive deploys, so they are not needed here.+ failed=0+ for name in CLOUDFLARE_API_TOKEN CLOUDFLARE_ACCOUNT_ID VITE_TURNSTILE_SITE_KEY; do+ if [[ -z "${!name}" ]]; then+ echo "::error::Missing production secret or variable: $name"+ failed=1+ elif [[ "${!name}" =~ [[:space:]] ]]; then+ echo "::error::$name contains whitespace or a line break; re-enter it"+ failed=1+ fi+ done+ exit "$failed"++ - name: Setup pnpm+ uses: pnpm/action-setup@v4++ - name: Setup Node.js+ uses: actions/setup-node@v4+ with:+ node-version: 22+ cache: pnpm+ cache-dependency-path: web/pnpm-lock.yaml++ - name: Install dependencies+ run: pnpm install --frozen-lockfile++ # web/package.json's deploy:prod: the build refuses to run without a real+ # site key, then wrangler uploads the bundle, DO migration, and bindings.+ - name: Build and deploy+ run: pnpm run deploy:prod+ env:+ CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}+ CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}+ VITE_TURNSTILE_SITE_KEY: ${{ vars.WEBSITE_TURNSTILE_SITE_KEY }}diff --git a/docs/maintainers/production-deployment.md b/docs/maintainers/production-deployment.mdindex ea11b324..22dfc708 100644--- a/docs/maintainers/production-deployment.md+++ b/docs/maintainers/production-deployment.md@@ -113,3 +113,26 @@ backward compatible so any of these is safe.```The stack is identical, so this and the workflow can be used interchangeably.++## Website (openseo.so)++The marketing site in `web/` is a separate worker, `open-seo-landing`, deployed+by the `Deploy website` workflow with wrangler rather than Alchemy. It runs+automatically when a merge to `main` changes `web/**`, and can be dispatched by+hand:++```sh+pnpm deploy:web+```++It uses the same `production` environment and Cloudflare token. The only extra+value is the variable `WEBSITE_TURNSTILE_SITE_KEY`, the public site key of the+"OpenSEO - Marketing Site" Turnstile widget; `vite build` inlines it and refuses+to build without a real one. The worker's runtime secrets+(`TURNSTILE_SECRET_KEY`, `DATAFORSEO_API_KEY`, `LOOPS_API_KEY`,+`LOOPS_PRODUCT_UPDATES_LIST_ID`, `META_PIXEL_ID`, `META_CONVERSIONS_API_TOKEN`)+are not part of the workflow: wrangler keeps a worker's existing secrets across+deploys, so set or rotate them from `web/` with `wrangler secret put <NAME>`.++To roll back, use Cloudflare dashboard > Workers > `open-seo-landing` >+Deployments, or revert the commit on `main` (the revert redeploys on merge).diff --git a/package.json b/package.jsonindex a71f6d7d..d0957e09 100644--- a/package.json+++ b/package.json@@ -16,6 +16,7 @@"deploy": "npm run db:migrate:prod && npm run build && wrangler deploy -c dist/open_seo_audit/wrangler.json && wrangler deploy","deploy:selfhost": "node scripts/selfhost-deploy-preflight.mjs && vite build --mode selfhost && tsc --noEmit && pnpm alchemy deploy deploy/alchemy/alchemy.run.ts --env-file .env.selfhost --stage selfhost","deploy:prod": "gh workflow run deploy-production.yml --repo bensenescu/open-seo --ref main",+ "deploy:web": "gh workflow run deploy-website.yml --repo bensenescu/open-seo --ref main","deploy:preview": "vite build --mode preview && pnpm alchemy deploy deploy/alchemy/alchemy.run.ts --env-file .env.preview","preview:access": "pnpm alchemy deploy deploy/alchemy/alchemy.preview-access.run.ts --env-file .env.preview --stage preview-access --adopt","alchemy": "NODE_OPTIONS=\"$NODE_OPTIONS --experimental-strip-types\" alchemy",