新增CICD相关文件
This commit is contained in:
		
							
								
								
									
										50
									
								
								.drone.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								.drone.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,50 @@ | ||||
| kind: pipeline | ||||
| type: docker | ||||
| name: build | ||||
| trigger: | ||||
|   event: [ push ] | ||||
|   branch: [ master ] | ||||
| volumes: | ||||
|   - name: node_modules | ||||
|     host: | ||||
|       # 宿主机的绝对路径 | ||||
|       path: /tmp/drone/cache/node_modules | ||||
| steps: | ||||
|   - name: build-project | ||||
|     image: node:16.15.1 | ||||
|     volumes: | ||||
|       - name: node_modules | ||||
|         path: /drone/src/node_modules | ||||
|     commands: | ||||
|       - pwd | ||||
|       - ls -alt | ||||
|       - npm config set registry https://registry.npm.taobao.org # 切换淘宝镜像 | ||||
|       - npm install | ||||
|       - npm run build | ||||
|     when: | ||||
|       event: push | ||||
|   - name: deploy-project | ||||
|     image: appleboy/drone-scp | ||||
|     settings: | ||||
|       host: 1.117.68.37 | ||||
|       username: root | ||||
|       password: | ||||
|         from_secret: jxb_server_pwd | ||||
|       port: 22 | ||||
|       target: /www/wwwroot/jxb.admin.guwengkj.com  #宿主机绝对路径 | ||||
|       source: ./dist/* | ||||
|       script: | ||||
|         - rm -rf /www/wwwroot/jxb.admin.guwengkj.com/dist/ | ||||
|     when: | ||||
|       event: push | ||||
|   - name: notify | ||||
|     pull: if-not-exists | ||||
|     image: guoxudongdocker/drone-dingtalk:latest | ||||
|     settings: | ||||
|       token: 9ad4ebd689e7833204dddfbc67435bc4fe82ab934614ea63a9b9fe4b6e206576 | ||||
|       type: markdown | ||||
|       message_color: true | ||||
|       message_pic: true | ||||
|       sha_link: true | ||||
|     when: | ||||
|       status: [ failure, success ] | ||||
		Reference in New Issue
	
	Block a user