init
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
yinsx
2026-01-05 10:36:23 +08:00
parent f94ffe0adc
commit 0db59a9173

View File

@ -1,56 +1,39 @@
kind: pipeline # 定义一个管道 kind: pipeline
type: docker # 当前管道的类型 type: docker
name: test # 当前管道的名称 name: test
steps: steps:
# Step 1: build project
# 第一步:构建项目 - name: build
- name: 构建项目
image: node:18-alpine image: node:18-alpine
commands: commands:
- rm -rf node_modules - rm -rf node_modules
- npm ci - npm ci
- npm run build - npm run build
# 第二步上传静态资源到腾讯云COS (使用另一个插件) # Step 2: prepare server
- name: 静态资源上传到cos - name: clear-server-cache
image: ccr.ccs.tencentyun.com/xiaoqidun/gocos:latest
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_path: dist
target_path: /studio
strip_prefix: dist
# 第三步:部署到服务器
- name: 清除服务器缓存
image: appleboy/drone-ssh image: appleboy/drone-ssh
settings: settings:
host: host:
from_secret: server_host from_secret: server_host
username: username:
from_secret: server_username from_secret: server_username
password: password:
from_secret: server_password from_secret: server_password
# 或者使用SSH密钥
# key:
# from_secret: server_ssh_key
port: 22 port: 22
script: script:
- rm -rf /www/wwwroot/studio.zguiy.com/* - rm -rf /www/wwwroot/doc.zguiy.com/*
- mkdir -p /www/wwwroot/studio.zguiy.com/ - mkdir -p /www/wwwroot/doc.zguiy.com/
- chmod 755 /www/wwwroot/studio.zguiy.com/ - chmod 755 /www/wwwroot/doc.zguiy.com/
when: when:
branch: branch:
- main - main
- master - master
- dev - dev
# 第四步:上传构建文件 # Step 3: upload build to server
- name: 上传构建文件 - name: upload-build
image: appleboy/drone-scp image: appleboy/drone-scp
settings: settings:
host: host:
@ -59,21 +42,16 @@ steps:
from_secret: server_username from_secret: server_username
password: password:
from_secret: server_password from_secret: server_password
# 或者使用SSH密钥
# key:
# from_secret: server_ssh_key
port: 22 port: 22
source: dist/* source: dist/*
target: /www/wwwroot/studio.zguiy.com/ target: /www/wwwroot/doc.zguiy.com/
strip_components: 1 strip_components: 1
when: when:
branch: branch:
- main - main
- master - master
- dev - dev
# 触发条件
trigger: trigger:
branch: branch:
- main - main