From 4c4d9d4680e5e203087aba5f20711a25b0eb83b2 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 26 Aug 2022 12:22:53 +0530 Subject: [PATCH] feat(wrangler): migrate to Wrangler 2 [deploy] --- .github/workflows/deploy-to-cloudflare.yml | 9 +++++++-- wrangler.toml | 7 ++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy-to-cloudflare.yml b/.github/workflows/deploy-to-cloudflare.yml index ef007d9..30f4730 100644 --- a/.github/workflows/deploy-to-cloudflare.yml +++ b/.github/workflows/deploy-to-cloudflare.yml @@ -33,13 +33,15 @@ jobs: - name: Build Hugo Site shell: bash run: | + yarn install hugo --minify --gc - name: Publish to Cloudflare Workers Sites - uses: cloudflare/wrangler-action@1.3.0 + uses: cloudflare/wrangler-action@2.0.0 with: apiToken: ${{ secrets.CF_API_TOKEN }} - environment: 'production' + accountId: ${{ secrets.CF_ACCOUNT_ID }} + command: publish --env production env: CF_ZONE_ID: ${{ secrets.CF_ZONE_ID }} @@ -71,11 +73,14 @@ jobs: - name: Build Hugo Site shell: bash run: | + yarn install hugo --minify --gc -D --baseUrl 'https://drafts.msfjarvis.dev/' - name: Publish to Cloudflare Workers Sites uses: cloudflare/wrangler-action@1.3.0 with: apiToken: ${{ secrets.CF_API_TOKEN }} + accountId: ${{ secrets.CF_ACCOUNT_ID }} + command: publish env: CF_ZONE_ID: ${{ secrets.CF_ZONE_ID }} diff --git a/wrangler.toml b/wrangler.toml index 9c15120..d748a01 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -1,6 +1,4 @@ name = "msfjarvis-dev-staging" -type = "webpack" -webpack_config = "webpack.config.js" workers_dev = false route = "drafts.msfjarvis.dev/*" vars = { BASE_URL = "https://drafts.msfjarvis.dev/" } @@ -8,10 +6,13 @@ compatibility_date = "2021-11-08" kv_namespaces = [ { binding = "NAMESPACE", id = "43d755465f4642ccb30b1bdce031d1da" } ] +main = "dist/worker.production.js" + +[build] +command = "yarn run build" [site] bucket = "./public" -entry-point = "workers-site" [env.production] name = "msfjarvis-dev-prod"