Merge pull request 'feature/ldb_build' (#30) from feature/ldb_build into main
Reviewed-on: ai-team/lingji-work-fe#30
This commit is contained in:
75
.drone.yml
75
.drone.yml
@ -3,40 +3,48 @@ type: docker
|
||||
name: build-deploy
|
||||
|
||||
clone:
|
||||
depth: 1 # ✅ 只拉取最近一次 commit,显著加快 clone 速度
|
||||
depth: 1
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
- custom
|
||||
branch:
|
||||
- master
|
||||
- test
|
||||
- feature/ldb_build
|
||||
event: [ push, custom ]
|
||||
branch: [ master, test, feature/ldb_build ]
|
||||
|
||||
steps:
|
||||
- name: install & build
|
||||
image: node:23.9.0
|
||||
image: node:22-bullseye-slim
|
||||
environment:
|
||||
# 统一走镜像,避免 npmjs 超时
|
||||
NPM_CONFIG_REGISTRY: https://registry.npmmirror.com
|
||||
PNPM_REGISTRY: https://registry.npmmirror.com
|
||||
# 提高容错
|
||||
PNPM_FETCH_RETRIES: "5"
|
||||
PNPM_FETCH_RETRY_MINTIMEOUT: "2000"
|
||||
PNPM_FETCH_RETRY_MAXTIMEOUT: "60000"
|
||||
PNPM_FETCH_TIMEOUT: "600000"
|
||||
CI: "true"
|
||||
# 固定 pnpm store 到缓存卷
|
||||
PNPM_STORE_DIR: /cache/pnpm
|
||||
volumes:
|
||||
- name: build-output
|
||||
path: /runner/builds
|
||||
- name: pnpm-store-cache
|
||||
path: /cache
|
||||
commands:
|
||||
- node -v && npm -v
|
||||
- corepack enable
|
||||
- corepack prepare pnpm@8.15.5 --activate
|
||||
- pnpm install
|
||||
- corepack prepare pnpm@10.13.1 --activate
|
||||
# 关键:先把所有包拉进本地 store(不执行 postinstall)
|
||||
- pnpm fetch
|
||||
|
||||
# 离线优先安装:命中 store 就不走网络;锁住 lockfile
|
||||
- pnpm install --frozen-lockfile --prefer-offline
|
||||
|
||||
- mkdir -p /runner/builds/${DRONE_REPO_NAME}/${DRONE_BRANCH}
|
||||
- |
|
||||
case "${DRONE_BRANCH}" in
|
||||
feature/ldb_build | test)
|
||||
pnpm run build:test
|
||||
;;
|
||||
master)
|
||||
pnpm run build:prod
|
||||
;;
|
||||
*)
|
||||
echo "❌ 未配置此分支的构建规则: ${DRONE_BRANCH}"
|
||||
exit 1
|
||||
;;
|
||||
feature/ldb_build|test) pnpm run build:test ;;
|
||||
master) pnpm run build:prod ;;
|
||||
*) echo "❌ 未配置此分支的构建规则: ${DRONE_BRANCH}"; exit 1 ;;
|
||||
esac
|
||||
- rm -rf /runner/builds/${DRONE_REPO_NAME}/${DRONE_BRANCH}/*
|
||||
- cp -r dist/* /runner/builds/${DRONE_REPO_NAME}/${DRONE_BRANCH}/
|
||||
@ -44,12 +52,8 @@ steps:
|
||||
- name: deploy to spug
|
||||
image: curlimages/curl
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
branch:
|
||||
- feature/ldb_build
|
||||
- test
|
||||
- master
|
||||
status: [ success ]
|
||||
branch: [ feature/ldb_build, test, master ]
|
||||
environment:
|
||||
SPUG_DEPLOY_URL:
|
||||
from_secret: spug_deploy_lingji_work_fe_url
|
||||
@ -64,18 +68,13 @@ steps:
|
||||
"ref": "refs/heads/'"${DRONE_BRANCH}"'",
|
||||
"before": "'"${DRONE_COMMIT_BEFORE}"'",
|
||||
"after": "'"${DRONE_COMMIT_SHA}"'",
|
||||
"commits": [
|
||||
{
|
||||
"message": "发布'"${DRONE_BRANCH}:${DRONE_COMMIT_SHA}"'"
|
||||
}
|
||||
]
|
||||
"commits": [{"message": "发布'"${DRONE_BRANCH}:${DRONE_COMMIT_SHA}"'"}]
|
||||
}'
|
||||
|
||||
- name: notify feishu on failure
|
||||
image: curlimages/curl
|
||||
when:
|
||||
status:
|
||||
- failure
|
||||
status: [ failure ]
|
||||
environment:
|
||||
FEISHU_WEBHOOK:
|
||||
from_secret: feishu_webhook_url
|
||||
@ -85,12 +84,14 @@ steps:
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"msg_type": "text",
|
||||
"content": {
|
||||
"text": "❌ Drone-CI 执行失败 ❗️\n项目: '${DRONE_REPO_NAME}'\n分支: '${DRONE_BRANCH}'\n提交: '${DRONE_COMMIT_SHA:0:8}'"
|
||||
}
|
||||
"content": { "text": "❌ Drone-CI 执行失败 ❗️\n项目: '${DRONE_REPO_NAME}'\n分支: '${DRONE_BRANCH}'\n提交: '${DRONE_COMMIT_SHA:0:8}'" }
|
||||
}'
|
||||
|
||||
volumes:
|
||||
- name: build-output
|
||||
host:
|
||||
path: /www/dk_project/dk_compose/spug/data/repos/build/drone-runner/builds
|
||||
- name: pnpm-store-cache
|
||||
host:
|
||||
# 建议为 pnpm store 单独准备一个可持久化目录
|
||||
path: /www/dk_project/dk_compose/spug/cache/pnpm-store
|
||||
|
||||
16
pnpm-lock.yaml
generated
16
pnpm-lock.yaml
generated
@ -46,7 +46,7 @@ importers:
|
||||
version: 4.17.21
|
||||
marked:
|
||||
specifier: ^16.1.1
|
||||
version: 16.1.1
|
||||
version: 16.1.2
|
||||
mitt:
|
||||
specifier: ^3.0.0
|
||||
version: 3.0.0
|
||||
@ -619,36 +619,42 @@ packages:
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@parcel/watcher-linux-arm-musl@2.5.1':
|
||||
resolution: {integrity: sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@parcel/watcher-linux-arm64-glibc@2.5.1':
|
||||
resolution: {integrity: sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@parcel/watcher-linux-arm64-musl@2.5.1':
|
||||
resolution: {integrity: sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@parcel/watcher-linux-x64-glibc@2.5.1':
|
||||
resolution: {integrity: sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [glibc]
|
||||
|
||||
'@parcel/watcher-linux-x64-musl@2.5.1':
|
||||
resolution: {integrity: sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg==}
|
||||
engines: {node: '>= 10.0.0'}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
libc: [musl]
|
||||
|
||||
'@parcel/watcher-win32-arm64@2.5.1':
|
||||
resolution: {integrity: sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw==}
|
||||
@ -3608,6 +3614,11 @@ packages:
|
||||
resolution: {integrity: sha512-4y7uGv8bd2WdM9vpQsiQNo41Ln1NvhvDRuVt0k2JZQ+ezN2uaQes7lZeZ+QQUHOLQAtDaBJ+7wCbi+ab/KFs+w==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
|
||||
marked@16.1.2:
|
||||
resolution: {integrity: sha512-rNQt5EvRinalby7zJZu/mB+BvaAY2oz3wCuCjt1RDrWNpS1Pdf9xqMOeC9Hm5adBdcV/3XZPJpG58eT+WBc0XQ==}
|
||||
engines: {node: '>= 20'}
|
||||
hasBin: true
|
||||
|
||||
match-file@0.2.2:
|
||||
resolution: {integrity: sha512-BDEZIcrBSnooL0zC72Yt3z1HhJiCq+2pMnHKVDeYN/cilCrz3KrpqKPm4ZOfWCoDolRl4QyKQpfRlQWF6PqnjQ==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@ -7876,7 +7887,6 @@ snapshots:
|
||||
dompurify@3.2.6:
|
||||
optionalDependencies:
|
||||
'@types/trusted-types': 2.0.7
|
||||
optional: true
|
||||
|
||||
domutils@1.7.0:
|
||||
dependencies:
|
||||
@ -9860,6 +9870,8 @@ snapshots:
|
||||
dependencies:
|
||||
object-visit: 1.0.1
|
||||
|
||||
marked@16.1.2: {}
|
||||
|
||||
match-file@0.2.2:
|
||||
dependencies:
|
||||
is-glob: 3.1.0
|
||||
|
||||
Reference in New Issue
Block a user