diff --git a/.drone.yml b/.drone.yml index 70836d9..c1e80ff 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,3 +1,77 @@ kind: pipeline # 定义一个管道 type: docker # 当前管道的类型 name: test # 当前管道的名称 + +steps: + # 第一步:构建项目 + - name: build + image: node:18-alpine + commands: + - npm install + - vite build + volumes: + - name: node_modules_cache + path: /drone/src/node_modules + + # 第二步:部署到服务器 + - name: deploy + image: appleboy/drone-ssh + settings: + host: + from_secret: server_host + username: + from_secret: server_username + password: + from_secret: server_password + # 或者使用SSH密钥 + # key: + # from_secret: server_ssh_key + port: 22 + script: + - rm -rf /www/wwwroot/show.zguiy.com/* + - mkdir -p /www/wwwroot/show.zguiy.com/ + when: + branch: + - main + - master + - dev + + # 第三步:上传构建文件 + - name: upload + image: appleboy/drone-scp + settings: + host: + from_secret: server_host + username: + from_secret: server_username + password: + from_secret: server_password + # 或者使用SSH密钥 + # key: + # from_secret: server_ssh_key + port: 22 + source: dist/* + target: /www/wwwroot/show.zguiy.com/ + strip_components: 1 + rm: true + when: + branch: + - main + - master + - dev + +# 定义数据卷用于缓存node_modules +volumes: + - name: node_modules_cache + host: + path: /tmp/drone_cache/node_modules + +# 触发条件 +trigger: + branch: + - main + - master + - dev + event: + - push + - pull_request diff --git a/1.vue b/1.vue deleted file mode 100644 index b58e52b..0000000 --- a/1.vue +++ /dev/null @@ -1,41 +0,0 @@ - - - - -