go_echo_wol/.drone.yml

71 lines
1.5 KiB
YAML

# .drone.yml
kind: pipeline
name: default
workspace:
base: /go
path: src/github.com/octocat/hello-world
steps:
- name: test
image: golang
commands:
- export GOPROXY=https://mirrors.aliyun.com/goproxy/
- go test
- name: clone_web
image: alpine/git
commands:
- mkdir /go/web
- ls /go/web
- git clone https://git.shagain.club/lingling/go_echo_wol_web.git /go/web
- git checkout master
- name: build_web
image: node
commands:
- cd /go/web/
- npm install yarn
- yarn config set registry https://registry.npm.taobao.org --global
- yarn
- sed -i 's?(dev_ws_url)?(dev_ws_url)?g' ./src/api/websocket.js
- yarn build
- name: build
image: golang
volumes:
- name: outdir
path: /root/web
commands:
- rm -rf /root/web/*
- rm -rf ./app/*
- cp -r /go/web/build/* ./app/
- sed -i 's?/static?/static/static?g' ./app/index.html
- sed -i 's?/favicon.ico?/static/favicon.ico?g' ./app/index.html
- sed -i 's?/logo192.png?/static/logo192.png?g' ./app/index.html
- sed -i 's?/manifest.json?/static/manifest.json?g' ./app/index.html
- bash bulid.sh
- name: 打包Docker镜像并推送
image: plugins/docker
settings:
repo: linglingking/go_wol_web
use_cache: true
username:
from_secret: docker_name
password:
from_secret: docker_password
auto_tag: true # 自动打tag
# 也可以用下面这个手动指定
# tags:
# - latest
# - 0.0.1
when:
event: push
branch: master
volumes:
- name: outdir
host:
path: /root/web