ci: 拆分 Drone CI 流水ian步骤并优化缓存配置
This commit is contained in:
1 parent
1fbdb17521
commit
a3b7ecb49f
1 file changed
+72
-8
+72
-8
@@ -13,21 +13,82 @@ trigger:
|
||||
- custom
|
||||
|
||||
steps:
|
||||
- name: build-and-deploy
|
||||
image: node:22
|
||||
environment:
|
||||
CLOUDFLARE_ACCOUNT_ID:
|
||||
from_secret: CLOUDFLARE_ACCOUNT_ID
|
||||
CLOUDFLARE_API_TOKEN:
|
||||
from_secret: CLOUDFLARE_API_TOKEN
|
||||
- name: install
|
||||
image: node:22-slim
|
||||
volumes:
|
||||
- name: pnpm-store
|
||||
path: /root/.local/share/pnpm/store
|
||||
commands:
|
||||
- corepack enable
|
||||
- pnpm install --frozen-lockfile --prefer-offline
|
||||
- pnpm run ci
|
||||
|
||||
- name: lint
|
||||
image: node:22-slim
|
||||
depends_on:
|
||||
- install
|
||||
commands:
|
||||
- corepack enable
|
||||
- pnpm run lint
|
||||
|
||||
- name: check
|
||||
image: node:22-slim
|
||||
depends_on:
|
||||
- install
|
||||
volumes:
|
||||
- name: svelte-cache
|
||||
path: /drone/src/.svelte-kit
|
||||
commands:
|
||||
- corepack enable
|
||||
- pnpm run check
|
||||
|
||||
- name: test
|
||||
image: node:22-slim
|
||||
depends_on:
|
||||
- install
|
||||
commands:
|
||||
- corepack enable
|
||||
- pnpm run test
|
||||
|
||||
- name: build
|
||||
image: node:22-slim
|
||||
depends_on:
|
||||
- lint
|
||||
- check
|
||||
- test
|
||||
volumes:
|
||||
- name: svelte-cache
|
||||
path: /drone/src/.svelte-kit
|
||||
commands:
|
||||
- corepack enable
|
||||
- pnpm run build
|
||||
|
||||
- name: deploy-db
|
||||
image: node:22-slim
|
||||
depends_on:
|
||||
- build
|
||||
environment:
|
||||
CLOUDFLARE_ACCOUNT_ID:
|
||||
from_secret: CLOUDFLARE_ACCOUNT_ID
|
||||
CLOUDFLARE_API_TOKEN:
|
||||
from_secret: CLOUDFLARE_API_TOKEN
|
||||
commands:
|
||||
- corepack enable
|
||||
- pnpm exec wrangler d1 migrations apply blogflare-db --remote
|
||||
|
||||
- name: deploy-pages
|
||||
image: node:22-slim
|
||||
depends_on:
|
||||
- deploy-db
|
||||
environment:
|
||||
CLOUDFLARE_ACCOUNT_ID:
|
||||
from_secret: CLOUDFLARE_ACCOUNT_ID
|
||||
CLOUDFLARE_API_TOKEN:
|
||||
from_secret: CLOUDFLARE_API_TOKEN
|
||||
volumes:
|
||||
- name: svelte-cache
|
||||
path: /drone/src/.svelte-kit
|
||||
commands:
|
||||
- corepack enable
|
||||
- pnpm exec wrangler pages deploy .svelte-kit/cloudflare --project-name=blogflare --branch=main
|
||||
|
||||
- name: notify-success
|
||||
@@ -78,3 +139,6 @@ volumes:
|
||||
- name: pnpm-store
|
||||
host:
|
||||
path: /tmp/drone/pnpm-store
|
||||
- name: svelte-cache
|
||||
host:
|
||||
path: /tmp/drone/blogflare-svelte-cache
|
||||
Reference in new issue
Block a user