kind: pipeline type: docker name: test steps: - name: 构建项目 image: node:18-alpine commands: - rm -rf node_modules - npm ci - npm run build - name: 静态资源上传到cos image: ccr.ccs.tencentyun.com/xiaoqidun/gocos settings: secret_id: from_secret: cos_secret_id secret_key: from_secret: cos_secret_key bucket_url: https://files-1302416092.cos.ap-shanghai.myqcloud.com source: dist target: /test strip_prefix: dist - name: 清除服务器缓存 image: appleboy/drone-ssh settings: host: from_secret: server_host username: from_secret: server_username password: from_secret: server_password port: 22 script: - rm -rf /www/wwwroot/show.zguiy.com/* - mkdir -p /www/wwwroot/show.zguiy.com/ - chmod 755 /www/wwwroot/show.zguiy.com/ when: branch: - main - master - dev - name: 上传构建文件 image: appleboy/drone-scp settings: host: from_secret: server_host username: from_secret: server_username password: from_secret: server_password port: 22 source: dist/* target: /www/wwwroot/show.zguiy.com/ strip_components: 1 when: branch: - main - master - dev # 移除 node_modules 缓存挂载 # volumes: 已删除 trigger: branch: - main - master - dev event: - push - pull_request