From e75e14a20b61e72c5ae089d2c36ee649dd1c93c4 Mon Sep 17 00:00:00 2001 From: Dylan Audius Date: Mon, 24 Aug 2026 10:25:03 -0700 Subject: [PATCH] ci(embed): deploy the embed player from main The embed had no deploy path. CircleCI used to ship it via `embed-deploy-production-cloudflare`, and #14504 deleted .circleci without porting that job, so packages/embed has not been deployed since 2026-06-23 - long enough that #14571 sat merged for four days with the old bundle still live. The package README still claims "Deployed via CI". Port the job into web.yml. Differences from the CircleCI original: - Triggers on main rather than release* branches, so a merged embed change ships without a release cut. - Not behind the production gate that web and desktop share. The embed is a self-contained player with no desktop/S3 half to coordinate with, and gating it would mean the deploy that just rotted for two months needs a human every time. - Runs `wrangler deploy` pinned to 4.54.0, matching the web deploy, instead of `npm run deploy:prod` - `wrangler publish` no longer exists in wrangler 4. Also adds packages/embed to the workflow's path filters. Without that an embed-only change doesn't trigger the workflow at all, which is why #14571 ran no CI beyond the security scanners. Two fixes the port depends on: - wrangler.toml was still wrangler-1.x era. `type = "webpack"` is silently ignored and `[site] entry-point` is deprecated; replaced with a top-level `main`. Verified with `--dry-run` on both the pinned 3.30.1 and 4.54.0 - clean on both, warnings on neither. - `deploy:prod` called `wrangler publish`, removed in wrangler 4, so the documented manual deploy was already broken on any current wrangler. The build/deploy split stays as it was: `build:prod` renames build/ to build-production/ and the deploy job renames it back, because wrangler.toml's [site] bucket points at ./build. That's why `build:prod && deploy:prod` on its own deploys nothing. Co-Authored-By: Claude Opus 5 --- .github/workflows/web.yml | 99 ++++++++++++++++++++++++++++++++++++ packages/embed/package.json | 2 +- packages/embed/wrangler.toml | 8 +-- 3 files changed, 105 insertions(+), 4 deletions(-) diff --git a/.github/workflows/web.yml b/.github/workflows/web.yml index 7b24f6fecb9..1d15714f122 100644 --- a/.github/workflows/web.yml +++ b/.github/workflows/web.yml @@ -6,6 +6,7 @@ on: - main paths: - 'packages/web/**' + - 'packages/embed/**' - 'packages/common/**' - 'packages/harmony/**' - 'packages/libs/**' @@ -15,6 +16,7 @@ on: pull_request: paths: - 'packages/web/**' + - 'packages/embed/**' - 'packages/common/**' - 'packages/harmony/**' - 'packages/libs/**' @@ -915,6 +917,103 @@ jobs: json_content="{ \"blocks\": [{ \"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \"Deployed production <${job_url}|v${deploying_version}> to web \n\" } }]}" curl -f -X POST -H 'Content-type: application/json' --data "$json_content" $SLACK_WEBHOOK + # Ported from the CircleCI `embed-deploy-production-cloudflare` job, which was + # dropped with the rest of .circleci in #14504 and never replaced - leaving the + # embed player with no deploy path at all. Unlike the old job (which only ran + # on release* branches) this deploys straight from main, and unlike the web + # deploy it isn't behind the production gate: the embed is a self-contained + # player with no desktop/S3 half to coordinate with. + embed-deploy: + name: Embed Deploy + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Upgrade npm to 11.10.0 + run: npm install -g npm@11.10.0 + + - name: Create concatenated patch file + id: patch-file + run: | + ls -d -- packages/*/patches/*.patch 2>/dev/null | xargs cat > combined-patch-file.txt || touch combined-patch-file.txt + echo "patch_checksum=$(sha256sum combined-patch-file.txt | cut -d' ' -f1)" >> $GITHUB_OUTPUT + + - name: Cache node modules + id: cache-node-modules + uses: actions/cache@v4 + with: + path: | + node_modules + packages/embed/node_modules + packages/harmony/node_modules + packages/common/node_modules + packages/libs/node_modules + packages/sdk/node_modules + key: npm-cache-${{ runner.os }}-node-${{ env.NODE_VERSION }}-${{ hashFiles('package-lock.json') }}-${{ steps.patch-file.outputs.patch_checksum }} + restore-keys: | + npm-cache-${{ runner.os }}-node-${{ env.NODE_VERSION }}-${{ hashFiles('package-lock.json') }}- + + - name: Install dependencies (if cache miss) + if: steps.cache-node-modules.outputs.cache-hit != 'true' + env: + CI: true + SKIP_POD_INSTALL: true + SKIP_ANDROID_INSTALL: true + ANDROID_HOME: /tmp/android-sdk-dummy + NODE_OPTIONS: --max-old-space-size=8192 + run: | + mkdir -p /tmp/android-sdk-dummy + npm cache clean --force || true + npm ci --prefer-offline || npm install --prefer-offline + + - name: Run postinstall (if cache hit) + if: steps.cache-node-modules.outputs.cache-hit == 'true' + env: + CI: true + SKIP_POD_INSTALL: true + SKIP_ANDROID_INSTALL: true + ANDROID_HOME: /tmp/android-sdk-dummy + NODE_OPTIONS: --max-old-space-size=8192 + run: | + mkdir -p /tmp/android-sdk-dummy + npm run postinstall + + # `build:prod` runs turbo, which builds the harmony/sdk dists first, then + # renames build/ to build-production/. + - name: Build embed + env: + NODE_OPTIONS: --max-old-space-size=8192 + run: | + cd packages/embed + npm run build:prod + + - name: Install workers-site dependencies + run: | + cd packages/embed/workers-site + npm i + + # wrangler.toml's [site] bucket points at ./build, so undo the rename that + # build:prod just did. The old CircleCI job did exactly this - the split + # is why `build:prod && deploy:prod` deploys nothing on its own. + - name: Move build + run: | + cd packages/embed + mv build-production build + + - name: Deploy to Cloudflare (Production) + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + run: | + cd packages/embed + npm_config_yes=true npx wrangler@4.54.0 deploy --env production + # Desktop (Electron) builds. electron-builder reads packages/web/build-production # directly (see packages/web/scripts/dist.js), so the `builds` artifact is # downloaded in place and not renamed. diff --git a/packages/embed/package.json b/packages/embed/package.json index b3b2d8d0d77..353e085cbf9 100644 --- a/packages/embed/package.json +++ b/packages/embed/package.json @@ -9,7 +9,7 @@ "build": "vite build", "build:prod": "env-cmd -f .env.prod turbo run build && npm run build-api && mv build build-production", "build-api": "webpack --config src/api/webpack.config.js -o build/api.js", - "deploy:prod": "npx wrangler publish --env production", + "deploy:prod": "wrangler deploy --env production", "test": "jest", "lint:fix": "eslint --cache --fix --ext=js,jsx,ts,tsx src", "lint": "eslint --cache --ext=js,jsx,ts,tsx src", diff --git a/packages/embed/wrangler.toml b/packages/embed/wrangler.toml index ae8b8bf0e1a..189aea0ce3c 100644 --- a/packages/embed/wrangler.toml +++ b/packages/embed/wrangler.toml @@ -1,11 +1,13 @@ compatibility_date = "2023-11-06" -type = "webpack" account_id = "3811365464a8e56b2b27a5590e328e49" workers_dev = true +# `main` replaces the old `[site] entry-point`, and the wrangler-1.x +# `type = "webpack"` field is gone - wrangler bundles the worker itself now. +main = "workers-site/index.js" + [site] bucket = "./build" -entry-point = "workers-site" [env.test] name = "test" @@ -13,4 +15,4 @@ route = "test.audius.co/*" [env.production] name = "embed" -route = "embed.audius.co/*" \ No newline at end of file +route = "embed.audius.co/*"