diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..06e75a9 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,48 @@ +kind: pipeline # 定义一个管道 +type: docker # 当前管道的类型 +load: "" +name: deploy-chan # 当前管道的名称 +volumes: # 声明数据卷(此为服务器中的实际目录) + - name: node_modules # 数据卷名称 + host: # Host Volume + path: /root/docker-compose/drone/chan/node_modules # 宿主机目录 #绝对路径 + - name: dist + host: + path: /var/www/chan # 打包目录 +clone: + disable: false # 启用代码 + depth: 1 + commands: + - git remote -v +steps: # 定义管道的执行步骤 + - name: build + image: gplane/pnpm:9.4.0 # 当前步骤使用的镜像 + pull: if-not-exists # 如果镜像不存在则拉取,免去每次都要重新下载 + depends_on: [clone] # 依赖的步骤 + volumes: # 挂载数据卷(此为容器内的目录) + - name: node_modules # 数据卷名称,相当于把node_modules挂载在下面的路径上 + path: /drone/src/node_modules # 容器内目录 绝对路径 + - name: dist + path: /drone/src/dist + commands: # 当前步骤执行的命令 + - ls + - pnpm config set registry https://registry.npmmirror.com # 切换源 + - pnpm i # 安装node_modules包 + - pnpm run build # 执行编译 +# - name: depoly +# depends_on: [build] # 依赖的步骤 +# image: appleboy/drone-scp +# volumes: # 挂载数据卷(此为容器内的目录) +# - name: dist +# path: /drone/src/dist +# settings: +# host: 159.75.81.123 +# username: +# from_secret: username +# password: +# from_secret: password +# port: 22 +# target: /home/astro/blog +# source: dist +# rm: true +# overwrite: true