kind: pipeline type: docker name: default platform: os: linux arch: amd64 steps: - name: 恢复缓存 image: drillster/drone-volume-cache volumes: - name: cache path: /cache settings: restore: true mount: - ./node_modules - ./.pnpm-store - name: 测试服-构建部署 pull: if-not-exists image: node:20-alpine when: branch: - test commands: - npm install -g pnpm - pnpm config set registry https://registry.npmmirror.com/ - pnpm config set store-dir ./.pnpm-store - pnpm install --frozen-lockfile - pnpm build:weapp:test:upload - rm -rf dist.tar - name: 正式服-构建部署 pull: if-not-exists image: node:20-alpine when: branch: - master commands: - npm install -g pnpm - pnpm config set registry https://registry.npmmirror.com/ - pnpm config set store-dir ./.pnpm-store - pnpm install --frozen-lockfile - pnpm build:weapp:prod:upload - rm -rf dist.tar - name: 重建缓存 image: drillster/drone-volume-cache volumes: - name: cache path: /cache settings: rebuild: true mount: - ./node_modules - ./.pnpm-store - name: 企业微信通知 pull: if-not-exists image: plugins/webhook when: branch: - test - master status: - success - failure settings: urls: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=a2065e21-4f92-4f5b-a432-2c0cd1d965b5 content_type: application/json template: | { "msgtype": "markdown", "markdown": { "content": "{{#success build.status}}✅ 构建成功{{else}}❌ 构建失败{{/success}}\n **项目**: {{ repo.owner }}/{{ repo.name }} (构建 #{{build.number}})\n **分支**: {{ build.branch }}\n **提交**: {{ build.commit }}\n **作者**: {{ build.author }}\n **信息**: {{ build.message }}\n **耗时**: {{ since build.started }} 分钟\n **详情**: [查看构建详情]({{ build.link }})" } } volumes: - name: cache host: path: /tmp/drone-cache