From 484909c2c5ad59828e44c6c9092b0e1dffe7a784 Mon Sep 17 00:00:00 2001 From: Carmen Popoviciu Date: Tue, 20 Aug 2024 22:03:17 +0200 Subject: [PATCH] chore(workers-shared): Configure GitHub Actions to deploy Asset Worker --- .github/workflows/changesets.yml | 1 + packages/workers-shared/asset-worker/README.md | 2 +- packages/workers-shared/asset-worker/wrangler.toml | 2 ++ packages/workers-shared/package.json | 2 ++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/changesets.yml b/.github/workflows/changesets.yml index c4bcc0c05f63..edaa365b863f 100644 --- a/.github/workflows/changesets.yml +++ b/.github/workflows/changesets.yml @@ -64,6 +64,7 @@ jobs: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} WORKERS_NEW_CLOUDFLARE_ACCOUNT_ID: ${{ secrets.WORKERS_NEW_CLOUDFLARE_ACCOUNT_ID }} WORKERS_NEW_CLOUDFLARE_API_TOKEN: ${{ secrets.WORKERS_NEW_CLOUDFLARE_API_TOKEN }} + WORKERS_DEPLOY_AND_CONFIG_CLOUDFLARE_API_TOKEN: ${{ secrets.WORKERS_DEPLOY_AND_CONFIG_CLOUDFLARE_API_TOKEN }} - name: Create C3 Diffs PR if: contains(steps.changesets.outputs.publishedPackages, '"create-cloudflare"') diff --git a/packages/workers-shared/asset-worker/README.md b/packages/workers-shared/asset-worker/README.md index eee3c83195aa..555e74dd7291 100644 --- a/packages/workers-shared/asset-worker/README.md +++ b/packages/workers-shared/asset-worker/README.md @@ -1,3 +1,3 @@ # `asset-worker` -The Asset Worker is a [Cloudflare Worker](https://developers.cloudflare.com/workers/) that is responsible of serving assets for Workers deployed on the edge, that contain static assets as well. +The Asset Worker is a [Cloudflare Worker](https://developers.cloudflare.com/workers/) that is responsible of serving static assets. It is deployed in production and is also used in local `wrangler dev`. diff --git a/packages/workers-shared/asset-worker/wrangler.toml b/packages/workers-shared/asset-worker/wrangler.toml index 52c101d14c04..97a2c3faf404 100644 --- a/packages/workers-shared/asset-worker/wrangler.toml +++ b/packages/workers-shared/asset-worker/wrangler.toml @@ -8,5 +8,7 @@ # (see packages/wrangler/src/dev/miniflare.ts -> buildMiniflareOptions()) ## name = "asset-worker" +account_id = "0f1b8aa119a907021f659042f95ea9ba" +workers_dev = false main = "src/index.ts" compatibility_date = "2024-07-31" diff --git a/packages/workers-shared/package.json b/packages/workers-shared/package.json index 9850528a427b..a128ee2f65c4 100644 --- a/packages/workers-shared/package.json +++ b/packages/workers-shared/package.json @@ -31,6 +31,8 @@ "check:type": "pnpm run check:type:tests && tsc", "check:type:tests": "tsc -p ./asset-worker/tests/tsconfig.json", "clean": "rimraf dist", + "deploy": "pnpm run deploy:asset-worker", + "deploy:asset-worker": "CLOUDFLARE_API_TOKEN=$WORKERS_NEW_CLOUDFLARE_API_TOKEN wrangler versions upload --experimental-versions -c asset-worker/wrangler.toml", "dev": "pnpm run clean && concurrently -n bundle:asset-worker,bundle:router-worker -c blue,magenta \"pnpm run bundle:asset-worker --watch\" \"pnpm run bundle:router-worker --watch\"", "test": "vitest", "test:ci": "pnpm run test run"