2024-12-29 17:12:07 +08:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: vue-deployment
|
|
|
|
|
|
|
|
steps:
|
|
|
|
# 编译
|
|
|
|
- name: build
|
|
|
|
image: node:lts
|
|
|
|
commands:
|
2024-12-29 17:12:07 +08:00
|
|
|
- npm config set registry https://mirrors.huaweicloud.com/repository/npm/
|
|
|
|
- rm -rf dist
|
2024-12-29 17:12:07 +08:00
|
|
|
- npm install
|
|
|
|
- npm run build
|
|
|
|
|
2024-12-29 17:12:07 +08:00
|
|
|
# 清除旧版本
|
|
|
|
- name: clean
|
|
|
|
image: appleboy/drone-ssh
|
|
|
|
when:
|
|
|
|
branch: deploy
|
|
|
|
event: push
|
|
|
|
settings:
|
|
|
|
host:
|
|
|
|
from_secret: ssh_host
|
|
|
|
username:
|
|
|
|
from_secret: ssh_username
|
|
|
|
key:
|
|
|
|
from_secret: ssh_key
|
|
|
|
port:
|
|
|
|
from_secret: ssh_port
|
|
|
|
command_timeout: 2m
|
|
|
|
script:
|
|
|
|
- 'rm -rf /root/sites/wuziqi.bitnet.fun/index/*'
|
|
|
|
|
2024-12-29 17:12:07 +08:00
|
|
|
# 部署
|
|
|
|
- name: deploy
|
|
|
|
image: appleboy/drone-scp
|
|
|
|
when:
|
|
|
|
branch: deploy
|
|
|
|
event: push
|
|
|
|
settings:
|
|
|
|
host:
|
|
|
|
from_secret: ssh_host
|
|
|
|
username:
|
|
|
|
from_secret: ssh_username
|
|
|
|
key:
|
|
|
|
from_secret: ssh_key
|
|
|
|
port:
|
|
|
|
from_secret: ssh_port
|
|
|
|
command_timeout: 2m
|
2024-12-29 17:12:07 +08:00
|
|
|
target: /root/sites/wuziqi.bitnet.fun/index/
|
|
|
|
overwrite: true
|
2024-12-29 17:12:07 +08:00
|
|
|
source:
|
2024-12-29 17:12:07 +08:00
|
|
|
- ./dist/*
|
|
|
|
strip_components: 1
|