From c676a158c03bac9d9a31af0429ab72a670c7a2aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E5=8F=8C=E5=96=9C?= <1415466602@qq.com> Date: Tue, 24 Jun 2025 21:21:06 +0800 Subject: [PATCH] 111133 --- .drone.yml | 10 +++++-- .drone1.yml | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/App.vue | 3 ++ 3 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 .drone1.yml diff --git a/.drone.yml b/.drone.yml index 5c83d37..ef5a832 100644 --- a/.drone.yml +++ b/.drone.yml @@ -19,8 +19,14 @@ steps: settings: endpoint: https://files-1302416092.cos.ap-shanghai.myqcloud.com secret: - id: xAKIDeAXigQxIQMCrKbfcOxJRL4atzrY2ILFvx - key: WoureDYgdOzR0eJn47AC6oJcopdDZhcK + id: + from_secret: cos_secret_id + key: + from_secret: cos_secret_key + source: dist/* + target: / + strip_components: 1 + clean: true # 第三步:部署到服务器 - name: deploy diff --git a/.drone1.yml b/.drone1.yml new file mode 100644 index 0000000..5c83d37 --- /dev/null +++ b/.drone1.yml @@ -0,0 +1,86 @@ +kind: pipeline # 定义一个管道 +type: docker # 当前管道的类型 +name: test # 当前管道的名称 + +steps: + # 第一步:构建项目 + - name: 构建 + image: node:18-alpine + commands: + - npm install + - npm run build + volumes: + - name: node_modules_cache + path: /drone/src/node_modules + + # 第二步:上传静态资源到腾讯云COS + - name: 上传到腾讯云 + image: ccr.ccs.tencentyun.com/dronestock/cos + settings: + endpoint: https://files-1302416092.cos.ap-shanghai.myqcloud.com + secret: + id: xAKIDeAXigQxIQMCrKbfcOxJRL4atzrY2ILFvx + key: WoureDYgdOzR0eJn47AC6oJcopdDZhcK + + # 第三步:部署到服务器 + - 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/ + - chmod 755 /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 + 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/src/App.vue b/src/App.vue index e0c3e7b..432ff6f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,6 +6,9 @@