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:
95
.drone.yml
95
.drone.yml
@ -3,40 +3,48 @@ type: docker
|
|||||||
name: build-deploy
|
name: build-deploy
|
||||||
|
|
||||||
clone:
|
clone:
|
||||||
depth: 1 # ✅ 只拉取最近一次 commit,显著加快 clone 速度
|
depth: 1
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
event:
|
event: [ push, custom ]
|
||||||
- push
|
branch: [ master, test, feature/ldb_build ]
|
||||||
- custom
|
|
||||||
branch:
|
|
||||||
- master
|
|
||||||
- test
|
|
||||||
- feature/ldb_build
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: install & build
|
- 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:
|
volumes:
|
||||||
- name: build-output
|
- name: build-output
|
||||||
path: /runner/builds
|
path: /runner/builds
|
||||||
|
- name: pnpm-store-cache
|
||||||
|
path: /cache
|
||||||
commands:
|
commands:
|
||||||
|
- node -v && npm -v
|
||||||
- corepack enable
|
- corepack enable
|
||||||
- corepack prepare pnpm@8.15.5 --activate
|
- corepack prepare pnpm@10.13.1 --activate
|
||||||
- pnpm install
|
# 关键:先把所有包拉进本地 store(不执行 postinstall)
|
||||||
|
- pnpm fetch
|
||||||
|
|
||||||
|
# 离线优先安装:命中 store 就不走网络;锁住 lockfile
|
||||||
|
- pnpm install --frozen-lockfile --prefer-offline
|
||||||
|
|
||||||
- mkdir -p /runner/builds/${DRONE_REPO_NAME}/${DRONE_BRANCH}
|
- mkdir -p /runner/builds/${DRONE_REPO_NAME}/${DRONE_BRANCH}
|
||||||
- |
|
- |
|
||||||
case "${DRONE_BRANCH}" in
|
case "${DRONE_BRANCH}" in
|
||||||
feature/ldb_build | test)
|
feature/ldb_build|test) pnpm run build:test ;;
|
||||||
pnpm run build:test
|
master) pnpm run build:prod ;;
|
||||||
;;
|
*) echo "❌ 未配置此分支的构建规则: ${DRONE_BRANCH}"; exit 1 ;;
|
||||||
master)
|
|
||||||
pnpm run build:prod
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "❌ 未配置此分支的构建规则: ${DRONE_BRANCH}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
- rm -rf /runner/builds/${DRONE_REPO_NAME}/${DRONE_BRANCH}/*
|
- rm -rf /runner/builds/${DRONE_REPO_NAME}/${DRONE_BRANCH}/*
|
||||||
- cp -r dist/* /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
|
- name: deploy to spug
|
||||||
image: curlimages/curl
|
image: curlimages/curl
|
||||||
when:
|
when:
|
||||||
status:
|
status: [ success ]
|
||||||
- success
|
branch: [ feature/ldb_build, test, master ]
|
||||||
branch:
|
|
||||||
- feature/ldb_build
|
|
||||||
- test
|
|
||||||
- master
|
|
||||||
environment:
|
environment:
|
||||||
SPUG_DEPLOY_URL:
|
SPUG_DEPLOY_URL:
|
||||||
from_secret: spug_deploy_lingji_work_fe_url
|
from_secret: spug_deploy_lingji_work_fe_url
|
||||||
@ -59,38 +63,35 @@ steps:
|
|||||||
- |
|
- |
|
||||||
echo "🚀 部署到 Spug: 分支 ${DRONE_BRANCH}"
|
echo "🚀 部署到 Spug: 分支 ${DRONE_BRANCH}"
|
||||||
curl -X POST "$SPUG_DEPLOY_URL?name=${DRONE_BRANCH}&token=$SPUG_DEPLOY_TOKEN" \
|
curl -X POST "$SPUG_DEPLOY_URL?name=${DRONE_BRANCH}&token=$SPUG_DEPLOY_TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
"ref": "refs/heads/'"${DRONE_BRANCH}"'",
|
"ref": "refs/heads/'"${DRONE_BRANCH}"'",
|
||||||
"before": "'"${DRONE_COMMIT_BEFORE}"'",
|
"before": "'"${DRONE_COMMIT_BEFORE}"'",
|
||||||
"after": "'"${DRONE_COMMIT_SHA}"'",
|
"after": "'"${DRONE_COMMIT_SHA}"'",
|
||||||
"commits": [
|
"commits": [{"message": "发布'"${DRONE_BRANCH}:${DRONE_COMMIT_SHA}"'"}]
|
||||||
{
|
}'
|
||||||
"message": "发布'"${DRONE_BRANCH}:${DRONE_COMMIT_SHA}"'"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}'
|
|
||||||
|
|
||||||
- name: notify feishu on failure
|
- name: notify feishu on failure
|
||||||
image: curlimages/curl
|
image: curlimages/curl
|
||||||
when:
|
when:
|
||||||
status:
|
status: [ failure ]
|
||||||
- failure
|
|
||||||
environment:
|
environment:
|
||||||
FEISHU_WEBHOOK:
|
FEISHU_WEBHOOK:
|
||||||
from_secret: feishu_webhook_url
|
from_secret: feishu_webhook_url
|
||||||
commands:
|
commands:
|
||||||
- |
|
- |
|
||||||
curl -X POST "$FEISHU_WEBHOOK" \
|
curl -X POST "$FEISHU_WEBHOOK" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
"msg_type": "text",
|
"msg_type": "text",
|
||||||
"content": {
|
"content": { "text": "❌ Drone-CI 执行失败 ❗️\n项目: '${DRONE_REPO_NAME}'\n分支: '${DRONE_BRANCH}'\n提交: '${DRONE_COMMIT_SHA:0:8}'" }
|
||||||
"text": "❌ Drone-CI 执行失败 ❗️\n项目: '${DRONE_REPO_NAME}'\n分支: '${DRONE_BRANCH}'\n提交: '${DRONE_COMMIT_SHA:0:8}'"
|
}'
|
||||||
}
|
|
||||||
}'
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: build-output
|
- name: build-output
|
||||||
host:
|
host:
|
||||||
path: /www/dk_project/dk_compose/spug/data/repos/build/drone-runner/builds
|
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
|
version: 4.17.21
|
||||||
marked:
|
marked:
|
||||||
specifier: ^16.1.1
|
specifier: ^16.1.1
|
||||||
version: 16.1.1
|
version: 16.1.2
|
||||||
mitt:
|
mitt:
|
||||||
specifier: ^3.0.0
|
specifier: ^3.0.0
|
||||||
version: 3.0.0
|
version: 3.0.0
|
||||||
@ -619,36 +619,42 @@ packages:
|
|||||||
engines: {node: '>= 10.0.0'}
|
engines: {node: '>= 10.0.0'}
|
||||||
cpu: [arm]
|
cpu: [arm]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@parcel/watcher-linux-arm-musl@2.5.1':
|
'@parcel/watcher-linux-arm-musl@2.5.1':
|
||||||
resolution: {integrity: sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q==}
|
resolution: {integrity: sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q==}
|
||||||
engines: {node: '>= 10.0.0'}
|
engines: {node: '>= 10.0.0'}
|
||||||
cpu: [arm]
|
cpu: [arm]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
'@parcel/watcher-linux-arm64-glibc@2.5.1':
|
'@parcel/watcher-linux-arm64-glibc@2.5.1':
|
||||||
resolution: {integrity: sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w==}
|
resolution: {integrity: sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w==}
|
||||||
engines: {node: '>= 10.0.0'}
|
engines: {node: '>= 10.0.0'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@parcel/watcher-linux-arm64-musl@2.5.1':
|
'@parcel/watcher-linux-arm64-musl@2.5.1':
|
||||||
resolution: {integrity: sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg==}
|
resolution: {integrity: sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg==}
|
||||||
engines: {node: '>= 10.0.0'}
|
engines: {node: '>= 10.0.0'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
'@parcel/watcher-linux-x64-glibc@2.5.1':
|
'@parcel/watcher-linux-x64-glibc@2.5.1':
|
||||||
resolution: {integrity: sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A==}
|
resolution: {integrity: sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A==}
|
||||||
engines: {node: '>= 10.0.0'}
|
engines: {node: '>= 10.0.0'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [glibc]
|
||||||
|
|
||||||
'@parcel/watcher-linux-x64-musl@2.5.1':
|
'@parcel/watcher-linux-x64-musl@2.5.1':
|
||||||
resolution: {integrity: sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg==}
|
resolution: {integrity: sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg==}
|
||||||
engines: {node: '>= 10.0.0'}
|
engines: {node: '>= 10.0.0'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
|
libc: [musl]
|
||||||
|
|
||||||
'@parcel/watcher-win32-arm64@2.5.1':
|
'@parcel/watcher-win32-arm64@2.5.1':
|
||||||
resolution: {integrity: sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw==}
|
resolution: {integrity: sha512-RFzklRvmc3PkjKjry3hLF9wD7ppR4AKcWNzH7kXR7GUe0Igb3Nz8fyPwtZCSquGrhU5HhUNDr/mKBqj7tqA2Vw==}
|
||||||
@ -3608,6 +3614,11 @@ packages:
|
|||||||
resolution: {integrity: sha512-4y7uGv8bd2WdM9vpQsiQNo41Ln1NvhvDRuVt0k2JZQ+ezN2uaQes7lZeZ+QQUHOLQAtDaBJ+7wCbi+ab/KFs+w==}
|
resolution: {integrity: sha512-4y7uGv8bd2WdM9vpQsiQNo41Ln1NvhvDRuVt0k2JZQ+ezN2uaQes7lZeZ+QQUHOLQAtDaBJ+7wCbi+ab/KFs+w==}
|
||||||
engines: {node: '>=0.10.0'}
|
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:
|
match-file@0.2.2:
|
||||||
resolution: {integrity: sha512-BDEZIcrBSnooL0zC72Yt3z1HhJiCq+2pMnHKVDeYN/cilCrz3KrpqKPm4ZOfWCoDolRl4QyKQpfRlQWF6PqnjQ==}
|
resolution: {integrity: sha512-BDEZIcrBSnooL0zC72Yt3z1HhJiCq+2pMnHKVDeYN/cilCrz3KrpqKPm4ZOfWCoDolRl4QyKQpfRlQWF6PqnjQ==}
|
||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
@ -7876,7 +7887,6 @@ snapshots:
|
|||||||
dompurify@3.2.6:
|
dompurify@3.2.6:
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@types/trusted-types': 2.0.7
|
'@types/trusted-types': 2.0.7
|
||||||
optional: true
|
|
||||||
|
|
||||||
domutils@1.7.0:
|
domutils@1.7.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -9860,6 +9870,8 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
object-visit: 1.0.1
|
object-visit: 1.0.1
|
||||||
|
|
||||||
|
marked@16.1.2: {}
|
||||||
|
|
||||||
match-file@0.2.2:
|
match-file@0.2.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
is-glob: 3.1.0
|
is-glob: 3.1.0
|
||||||
|
|||||||
Reference in New Issue
Block a user