--- kind: pipeline name: default volumes: - name: dockersock host: path: /var/run/docker.sock - name: cache host: path: /tmp/cache/visitor-new-api clone: disable: false steps: # - name: clone # image: alpine/git # commands: # - git clone https://git.net.dadashe.cn/longge/visitor-node-api.git . # - git checkout $DRONE_COMMIT - name: restore-cache pull: if-not-exists image: drillster/drone-volume-cache settings: restore: true mount: - ./.npm-cache - ./node_modules volumes: - name: cache path: /cache - name: install image: node:14.16.1 pull: if-not-exists commands: # 删除文件 npm install # - rm -rf package-lock.json - npm set strict-ssl false && npm --registry https://registry.npm.taobao.org install when: event: [push, pull_request] branch: [development, test, main, sso] - name: rebuild-cache pull: if-not-exists image: drillster/drone-volume-cache settings: rebuild: true mount: - ./.npm-cache - ./node_modules volumes: - name: cache path: /cache # build - name: build pull: if-not-exists image: node:14.16.1 commands: - npm run build when: event: [push, pull_request] branch: [development, test, main, sso] # docker-build - name: docker-build pull: if-not-exists image: plugins/docker volumes: - name: dockersock path: /var/run/docker.sock settings: repo: hub.kaiguawang.cn/longge/visitor-node-api registry: hub.kaiguawang.cn tags: - latest - '0.0.1' username: from_secret: docker_username password: from_secret: docker_password when: event: [push, pull_request] branch: [development, test, main] # run - name: dev-run image: appleboy/drone-ssh pull: if-not-exists settings: host: 172.17.0.1 username: root password: from_secret: ssh_password port: 22 command_timeout: 300s script: - cd /home/runtime/apps/visitor - docker compose up -d api when: event: [push, pull_request] branch: [development, main] - name: notify image: fifsky/drone-wechat-work pull: if-not-exists settings: url: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=95507e79-9ef7-4cd7-a20a-562f0d75c738 msgtype: markdown content: | {{if eq .Status "success" }} #### 🎉 ${DRONE_REPO} 构建成功 > Commit: ${DRONE_COMMIT_MESSAGE} > Author: ${DRONE_COMMIT_AUTHOR} {{else}} #### ❌ ${DRONE_REPO} 构建失败 > Commit: ${DRONE_COMMIT_MESSAGE} > Author: ${DRONE_COMMIT_AUTHOR} > 请立即修复!!! {{end}} when: status: - failure - success # - name: notify # image: fifsky/drone-wechat-work # pull: if-not-exists # # pull: always # settings: # url: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4166884e-9d7b-4e7a-a1c8-80d71d4755ba # msgtype: markdown # content: | # {{if eq .Status "success" }} # #### 🎉 ${DRONE_REPO} 构建成功 # > Commit: ${DRONE_COMMIT_MESSAGE} # > Author: ${DRONE_COMMIT_AUTHOR} # {{else}} # #### ❌ ${DRONE_REPO} 构建失败 # > Commit: ${DRONE_COMMIT_MESSAGE} # > Author: ${DRONE_COMMIT_AUTHOR} # > 请立即修复!!! # {{end}} # when: # status: # - failure # - success