2023-03-15 15:30:46 +08:00
|
|
|
kind: pipeline
|
2023-03-15 16:20:47 +08:00
|
|
|
name: linear-wctdreamwebsite-front-pipeline
|
2023-03-15 15:30:46 +08:00
|
|
|
|
|
|
|
platform:
|
|
|
|
os: linux
|
|
|
|
arch: amd64
|
|
|
|
|
|
|
|
workspace:
|
|
|
|
path: /drone/src
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
branch:
|
|
|
|
- master
|
|
|
|
event:
|
|
|
|
- push
|
|
|
|
|
|
|
|
image_pull_secrets:
|
|
|
|
- docker_auth_config
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
- name: cache
|
|
|
|
host:
|
|
|
|
path: /tmp/cache
|
|
|
|
|
|
|
|
steps:
|
|
|
|
|
|
|
|
#加载缓存node_modules
|
|
|
|
- name: restore-cache
|
|
|
|
image: sinlead/drone-cache:1.0.0
|
|
|
|
volumes:
|
|
|
|
- name: cache
|
|
|
|
path: /cache
|
|
|
|
settings:
|
|
|
|
action: load
|
|
|
|
key: package-lock.json
|
|
|
|
mount: node_modules
|
|
|
|
prefix: npm-modules-v1
|
|
|
|
when:
|
|
|
|
event: [ push ]
|
|
|
|
branch: [ master ]
|
|
|
|
|
|
|
|
#安装缓存
|
|
|
|
- name: install-cache
|
|
|
|
image: node:16
|
|
|
|
commands:
|
|
|
|
- CI=false
|
|
|
|
- echo 'nuxt项目 build 缓存安装'
|
|
|
|
- npm config set registry https://registry.npm.taobao.org
|
|
|
|
- npm config set disturl https://npm.taobao.org/dist
|
|
|
|
- npm config set electron_mirror https://npm.taobao.org/mirrors/electron/
|
|
|
|
- npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
|
|
|
|
- npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/
|
|
|
|
- npm install cnpm -g
|
|
|
|
# - npm cache clear --force
|
|
|
|
- npm install
|
|
|
|
- cnpm install
|
|
|
|
when:
|
|
|
|
event: [ push, pull_request ]
|
|
|
|
branch: [ master ]
|
|
|
|
|
|
|
|
- name: rebuild-cache
|
|
|
|
image: sinlead/drone-cache:1.0.0
|
|
|
|
rebuild: true
|
|
|
|
volumes:
|
|
|
|
- name: cache
|
|
|
|
path: /cache
|
|
|
|
settings:
|
|
|
|
action: save
|
|
|
|
key: package-lock.json
|
|
|
|
mount: node_modules
|
|
|
|
prefix: npm-modules-v1
|
|
|
|
when:
|
|
|
|
event: [ push ]
|
|
|
|
branch: [ master ]
|
|
|
|
|
|
|
|
|
|
|
|
- name: build
|
|
|
|
image: node:16
|
|
|
|
commands:
|
|
|
|
- CI=false
|
|
|
|
- echo 'nuxt项目 build 打包部署'
|
|
|
|
- npm config set registry https://registry.npm.taobao.org
|
|
|
|
- npm config set disturl https://npm.taobao.org/dist
|
|
|
|
- npm config set electron_mirror https://npm.taobao.org/mirrors/electron/
|
|
|
|
- npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
|
|
|
|
- npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/
|
|
|
|
- npm install cnpm -g
|
|
|
|
- npm install
|
|
|
|
- cnpm install
|
|
|
|
- npm run build
|
|
|
|
- mkdir source
|
|
|
|
- mv .nuxt static nuxt.config.js package.json package-lock.json docker-compose.yml Dockerfile source
|
|
|
|
- ls -al source
|
|
|
|
when:
|
|
|
|
status: [ success ]
|
|
|
|
|
|
|
|
- name: deploy
|
|
|
|
image: drillster/drone-rsync
|
|
|
|
settings:
|
|
|
|
hosts:
|
2023-03-15 18:11:11 +08:00
|
|
|
- 175.97.185.33
|
2023-03-15 15:30:46 +08:00
|
|
|
user: root
|
|
|
|
prot: 22
|
|
|
|
key:
|
|
|
|
from_secret: SSH_KEY
|
|
|
|
source: ./source/
|
2023-03-15 16:20:47 +08:00
|
|
|
target: /wwwroot/wctdreamwebsite-front
|
2023-03-15 15:30:46 +08:00
|
|
|
include: []
|
|
|
|
exclude: []
|
|
|
|
script:
|
2023-03-15 16:20:47 +08:00
|
|
|
- cd /wwwroot/wctdreamwebsite-front
|
2023-03-15 15:30:46 +08:00
|
|
|
- ls -al
|
|
|
|
- docker-compose down
|
|
|
|
- docker-compose up --build -d
|
2023-03-15 16:20:47 +08:00
|
|
|
- docker ps | grep wctdreamwebsite-front
|
2023-03-15 15:30:46 +08:00
|
|
|
when:
|
|
|
|
status: [ success ]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|