From 1421040702f568f5ff6bf368d6aa6a51f0d33bac Mon Sep 17 00:00:00 2001 From: storywithoutend Date: Tue, 21 Oct 2025 18:07:37 +0800 Subject: [PATCH 1/2] Add staging worker --- .github/workflows/deploy.yml | 1 + wrangler.jsonc | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 251f762..5c36619 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -44,6 +44,7 @@ jobs: with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + environment: staging - name: Push changes run: git push diff --git a/wrangler.jsonc b/wrangler.jsonc index 04ca86d..d0ace67 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -32,6 +32,7 @@ }, "env": { "staging": { + "name": "avatar-upload-staging", "vars": { "ENVIRONMENT": "staging" } From 629aa1e5e12ea0cec2d3349d3b6442f5d2444b3c Mon Sep 17 00:00:00 2001 From: storywithoutend Date: Wed, 29 Oct 2025 19:10:23 +0800 Subject: [PATCH 2/2] feat: Add conditional deployment based on release type and configure R2 buckets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update deploy workflow to deploy to staging for pre-releases and production for regular releases - Add R2 bucket bindings for both staging and production environments - Configure keep_vars option in wrangler config 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/deploy.yml | 2 +- wrangler.jsonc | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5c36619..1e4a07e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -44,7 +44,7 @@ jobs: with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - environment: staging + environment: ${{ github.event.release.prerelease && 'staging' || 'production' }} - name: Push changes run: git push diff --git a/wrangler.jsonc b/wrangler.jsonc index d0ace67..c61b380 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -3,6 +3,7 @@ "name": "avatar-upload", "main": "src/index.ts", "compatibility_date": "2025-02-18", + "keep_vars": true, // "compatibility_flags": [ // "nodejs_compat" // ], @@ -33,11 +34,32 @@ "env": { "staging": { "name": "avatar-upload-staging", + "r2_buckets": [ + { + "binding": "AVATAR_BUCKET", + "bucket_name": "avatar-storage" + }, + { + "binding": "HEADER_BUCKET", + "bucket_name": "header-storage" + } + ], "vars": { "ENVIRONMENT": "staging" } }, "production": { + "name": "avatar-upload", + "r2_buckets": [ + { + "binding": "AVATAR_BUCKET", + "bucket_name": "avatar-storage" + }, + { + "binding": "HEADER_BUCKET", + "bucket_name": "header-storage" + } + ], "vars": { "ENVIRONMENT": "production" }