149 lines
3.3 KiB
YAML
149 lines
3.3 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: default
|
|
|
|
node:
|
|
name: pve
|
|
|
|
trigger:
|
|
branch:
|
|
- main
|
|
event:
|
|
- push
|
|
- custom
|
|
|
|
steps:
|
|
- 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
|
|
|
|
- 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
|
|
image: appleboy/drone-telegram
|
|
depends_on:
|
|
- deploy-pages
|
|
settings:
|
|
token:
|
|
from_secret: TELEGRAM_BOT_TOKEN
|
|
to:
|
|
from_secret: TELEGRAM_CHAT_ID
|
|
format: html
|
|
message: |
|
|
🎉 <b>BlogFlare 自动化部署成功!</b>
|
|
|
|
📦 <b>提交变动说明:</b>
|
|
<code>{{ commit.message }}</code>
|
|
|
|
🔗 <b>构建详情:</b> <a href="{{ build.link }}">查看 Drone 运行记录</a>
|
|
|
|
🚀 全套改动现已全网完成发布部署!
|
|
when:
|
|
status:
|
|
- success
|
|
|
|
- name: notify-failure
|
|
image: appleboy/drone-telegram
|
|
depends_on:
|
|
- deploy-pages
|
|
settings:
|
|
token:
|
|
from_secret: TELEGRAM_BOT_TOKEN
|
|
to:
|
|
from_secret: TELEGRAM_CHAT_ID
|
|
format: html
|
|
message: |
|
|
❌ <b>BlogFlare 构建与发布遭遇失败中断!</b>
|
|
|
|
📦 <b>提交变动说明:</b>
|
|
<code>{{ commit.message }}</code>
|
|
|
|
💥 <b>失败步骤:</b> <code>{{ build.failed_step }}</code>
|
|
👤 <b>提交作者:</b> {{ commit.author }}
|
|
🔗 <b>详细报错日志:</b> <a href="{{ build.link }}">点击直达 Drone 报错现场记录</a>
|
|
|
|
⚠️ 请立刻点击上述日志链接查看完整运行记录,扫清排查代码层或通讯网络上的潜在卡塞问题。
|
|
when:
|
|
status:
|
|
- failure
|
|
|
|
volumes:
|
|
- name: pnpm-store
|
|
host:
|
|
path: /tmp/drone/pnpm-store
|
|
- name: svelte-cache
|
|
host:
|
|
path: /tmp/drone/blogflare-svelte-cache
|