From 9692b7a2433e12888814c3ee563cce7195c44daa Mon Sep 17 00:00:00 2001 From: Jumpei Ogawa Date: Thu, 30 Apr 2026 13:32:46 +0900 Subject: [PATCH] ci: use Cloudflare Workers CI/CD with mise It works by setting `rm -f ~/.tool-versions && curl https://mise.run | sh && mise install && mise build` from Cloudflare Workers Setting. --- .github/workflows/actions.yml | 34 ---------------------------------- mise.toml | 6 ++++++ wrangler.jsonc | 17 ++++------------- 3 files changed, 10 insertions(+), 47 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index d850a41..86ffe26 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -36,37 +36,3 @@ jobs: cache: true - run: mise lint - - deploy: - needs: - - lint - runs-on: ubuntu-latest - timeout-minutes: 5 - permissions: - contents: read - pull-requests: write - env: - NODE_ENV: production - SERVER_ENV: production - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1 - with: - install: true - cache: false - - - run: mise build - - - name: deploy Worker - id: deployment - uses: cloudflare/wrangler-action@9acf94ace14e7dc412b076f2c5c20b8ce93c79cd # v3.15 - with: - environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }} - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - - - name: Add comment for deployment URL - if: github.ref != 'refs/heads/main' - run: "gh pr comment ${{ github.event.number }} --edit-last --create-if-none --body 'Deployed to staging:\n${{ steps.deployment.outputs.pages-deployment-alias-url && steps.deployment.outputs.pages-deployment-alias-url || steps.deployment.outputs.deployment-url }}'" - env: - GH_TOKEN: ${{ github.token }} diff --git a/mise.toml b/mise.toml index c0a3662..0b6e5ef 100644 --- a/mise.toml +++ b/mise.toml @@ -26,6 +26,12 @@ run = "git clean -dX --exclude=\"!.env\" --force" depends = [ "clean" ] run = "rm --force ./pnpm-lock.yaml && corepack enable && corepack up && pnpm install" +[tasks.deploy] +run = "wrangler deploy" + +[tasks.deploy-preview] +run = "wrangler versions upload" + [hooks] postinstall = "corepack enable && pnpm install --frozen-lockfile" diff --git a/wrangler.jsonc b/wrangler.jsonc index f4836d1..10537a9 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -4,6 +4,7 @@ "name": "guildkit-website", "compatibility_date": "2025-09-25", "compatibility_flags": [ "nodejs_compat" ], + "workers_dev": false, "placement": { "mode": "smart" }, @@ -12,18 +13,8 @@ "directory": "./dist" }, - // Runtime environment variables - "env": { - "production": { - "vars": { - "NODE_ENV": "production", - "SERVER_ENV": "production" - }, - }, - "staging": { - "vars": { - "SERVER_ENV": "staging" - } - } + "vars": { + "SKIP_DEPENDENCY_INSTALL": true, + "NODE_VERSION": 24 } }