automated_api/.drone.yml
lixin 6bd32f5669
Some checks failed
continuous-integration/drone/push Build is failing
ci(.drone.yml): Switch back to pnpm for project management
- Reverted from npm to pnpm for all commands (install, build, start)
- Restored pnpm as the primary package manager in the CI pipeline
- Added node_modules volume for deploy step to ensure consistent dependencies
- Simplified and cleaned up comments in the configuration
2025-01-25 10:11:08 +08:00

60 lines
1.2 KiB
YAML

kind: pipeline
type: docker
name: nodejs-deploy
# 使用国内镜像加速
volumes:
- name: node_modules
host:
path: /usr/local/blackend/node_modules
- name: pnpm_cache
host:
path: /usr/local/blackend/pnpm_cache
steps:
- name: setup
image: node:22-alpine
depends_on: [clone]
volumes:
- name: node_modules
path: /drone/src/node_modules
- name: pnpm_cache
path: /root/.local/share/pnpm/store
commands:
# 配置镜像源
- npm config set registry https://registry.npmmirror.com
- npm install -g pnpm
- pnpm config set registry https://registry.npmmirror.com
# 安装依赖
- pnpm install
- name: build
image: node:22-alpine
depends_on: [setup]
volumes:
- name: node_modules
path: /drone/src/node_modules
commands:
# 构建项目
- pnpm run build
- name: deploy
image: node:22-alpine
depends_on: [build]
volumes:
- name: node_modules
path: /drone/src/node_modules
commands:
# 启动服务
- pnpm start
environment:
NODE_ENV: production
PORT: 8001
trigger:
branch:
- main
- develop
event:
- push
- pull_request