From 57b219c7d4c5f27db308eaa5f542affb2e2177aa Mon Sep 17 00:00:00 2001 From: Hirotaka Mizutani <52546+hirotaka@users.noreply.github.com> Date: Fri, 3 Apr 2026 23:56:31 +0900 Subject: [PATCH 1/2] feat: update use menu --- .env.example | 4 +-- app/components/UserMenu.vue | 63 +++++++++++++++++++++++++++---------- wrangler.jsonc | 1 + 3 files changed, 49 insertions(+), 19 deletions(-) diff --git a/.env.example b/.env.example index a0d9787..3ce2a99 100644 --- a/.env.example +++ b/.env.example @@ -15,6 +15,6 @@ BLOB_READ_WRITE_TOKEN= # S3_REGION= # Dev auth passthrough (optional, dev environment only) # Uncomment and set values to skip GitHub OAuth during development -# NUXT_DEV_USER_NAME=dev-user +# NUXT_DEV_USER_NAME=dev # NUXT_DEV_USER_EMAIL=dev@example.com -# NUXT_DEV_USER_AVATAR=https://github.com/identicons/dev.png +# NUXT_DEV_USER_AVATAR=https://avatars.githubusercontent.com/u/263761647 diff --git a/app/components/UserMenu.vue b/app/components/UserMenu.vue index a0dd0bf..e26f0d9 100644 --- a/app/components/UserMenu.vue +++ b/app/components/UserMenu.vue @@ -55,17 +55,11 @@ function logout() { Appearance - + Light - + Dark @@ -81,28 +75,63 @@ function logout() { Templates - + Starter - + Landing - + Docs - + SaaS - + Dashboard Chat - + Portfolio - + Changelog @@ -111,11 +140,11 @@ function logout() { - + Documentation - + GitHub repository diff --git a/wrangler.jsonc b/wrangler.jsonc index 11be0ac..f23b33e 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -8,6 +8,7 @@ ], "env": { "preview": { + "routes": [], "d1_databases": [ { "binding": "DB", From 9287a29d52d173fe9a1a89573629c68b9c4a7769 Mon Sep 17 00:00:00 2001 From: Hirotaka Mizutani <52546+hirotaka@users.noreply.github.com> Date: Sat, 4 Apr 2026 14:30:54 +0900 Subject: [PATCH 2/2] chore: update deploy --- .github/workflows/deploy-preview.yml | 40 ++++++++++++++++++ .github/workflows/deploy.yml | 62 +++++----------------------- server/plugins/dev-auth.ts | 2 +- wrangler.jsonc | 5 +++ 4 files changed, 57 insertions(+), 52 deletions(-) create mode 100644 .github/workflows/deploy-preview.yml diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml new file mode 100644 index 0000000..22a9d50 --- /dev/null +++ b/.github/workflows/deploy-preview.yml @@ -0,0 +1,40 @@ +name: deploy +on: + pull_request: + branches: [main] +jobs: + preview: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - uses: actions/checkout@v6 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v6 + with: + node-version: 24 + cache: pnpm + - run: pnpm install + - name: Build + run: pnpm build + env: + NITRO_PRESET: cloudflare-module + CLOUDFLARE_ENV: preview + NODE_OPTIONS: --max-old-space-size=4096 + - name: Upload Preview Version + id: preview + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + workingDirectory: .output + preCommands: wrangler d1 migrations apply DB --remote --config server/wrangler.json + command: versions upload + - name: Comment Preview URL + uses: marocchino/sticky-pull-request-comment@v3 + with: + header: deploy-preview + message: | + **Preview Deployment** + ${{ steps.preview.outputs.deployment-url }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7fd9a9d..811a271 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,67 +2,27 @@ name: deploy on: push: branches: [main] - pull_request: - branches: [main] jobs: - deploy-production: - if: github.event_name == 'push' + production: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v6 - - name: Install pnpm - uses: pnpm/action-setup@v4 - - name: Install node - uses: actions/setup-node@v6 + - uses: actions/checkout@v6 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v6 with: node-version: 24 cache: pnpm - - name: Install dependencies - run: pnpm install + - run: pnpm install - name: Build run: pnpm build env: NITRO_PRESET: cloudflare-module NODE_OPTIONS: --max-old-space-size=4096 - - name: Apply D1 Migrations - run: npx wrangler d1 migrations apply DB --remote --config .output/server/wrangler.json - env: - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - name: Deploy - run: npx wrangler --cwd .output deploy - env: - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - deploy-preview: - if: github.event_name == 'pull_request' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v6 - - name: Install pnpm - uses: pnpm/action-setup@v4 - - name: Install node - uses: actions/setup-node@v6 + uses: cloudflare/wrangler-action@v3 with: - node-version: 24 - cache: pnpm - - name: Install dependencies - run: pnpm install - - name: Build - run: pnpm build - env: - NITRO_PRESET: cloudflare-module - CLOUDFLARE_ENV: preview - NODE_OPTIONS: --max-old-space-size=4096 - - name: Apply D1 Migrations - run: npx wrangler d1 migrations apply DB --remote --config .output/server/wrangler.json --env preview - env: - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - - name: Deploy - run: npx wrangler --cwd .output deploy --env preview - env: - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + workingDirectory: .output + preCommands: wrangler d1 migrations apply DB --remote --config server/wrangler.json + command: deploy diff --git a/server/plugins/dev-auth.ts b/server/plugins/dev-auth.ts index 9829d0b..6414047 100644 --- a/server/plugins/dev-auth.ts +++ b/server/plugins/dev-auth.ts @@ -4,7 +4,7 @@ import { and, eq } from 'drizzle-orm' const DEV_PROVIDER_ID = 'dev-user' export default defineNitroPlugin((nitroApp) => { - if (!import.meta.dev) return + if (!import.meta.dev && !process.env.NUXT_DEV_USER_NAME) return const name = process.env.NUXT_DEV_USER_NAME const email = process.env.NUXT_DEV_USER_EMAIL diff --git a/wrangler.jsonc b/wrangler.jsonc index f23b33e..c25327e 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -9,6 +9,11 @@ "env": { "preview": { "routes": [], + "vars": { + "NUXT_DEV_USER_NAME": "preview", + "NUXT_DEV_USER_EMAIL": "preview@example.com", + "NUXT_DEV_USER_AVATAR": "https://github.com/identicons/preview.png" + }, "d1_databases": [ { "binding": "DB",