go_echo_wol/.drone.yml

71 lines
1.5 KiB
YAML
Raw Normal View History

2023-09-11 11:38:59 +08:00
# .drone.yml
kind: pipeline
name: default
2023-09-12 09:44:14 +08:00
workspace:
2023-09-12 09:50:39 +08:00
base: /go
2023-09-12 09:44:14 +08:00
path: src/github.com/octocat/hello-world
2023-09-11 11:38:59 +08:00
steps:
2023-09-11 17:41:32 +08:00
- name: test
image: golang
commands:
- export GOPROXY=https://mirrors.aliyun.com/goproxy/
2023-09-12 11:06:56 +08:00
- go test
2023-09-11 11:38:59 +08:00
2023-09-11 17:17:53 +08:00
- name: clone_web
image: alpine/git
2023-09-11 16:59:25 +08:00
commands:
2023-09-12 09:50:39 +08:00
- mkdir /go/web
- ls /go/web
- git clone https://git.shagain.club/lingling/go_echo_wol_web.git /go/web
2023-09-11 16:59:25 +08:00
- git checkout master
2023-09-11 17:17:53 +08:00
- name: build_web
image: node
commands:
2023-09-12 09:50:39 +08:00
- cd /go/web/
2023-09-11 16:59:25 +08:00
- npm install yarn
2023-09-11 17:39:58 +08:00
- yarn config set registry https://registry.npm.taobao.org --global
2023-09-11 16:59:25 +08:00
- yarn
- sed -i 's?(dev_ws_url)?(dev_ws_url)?g' ./src/api/websocket.js
2023-09-11 16:59:25 +08:00
- yarn build
2023-09-11 11:38:59 +08:00
- name: build
image: golang
2023-09-11 17:43:54 +08:00
volumes:
2023-09-11 17:17:53 +08:00
- name: outdir
path: /root/web
2023-09-11 11:38:59 +08:00
commands:
- rm -rf /root/web/*
2023-09-11 16:59:25 +08:00
- rm -rf ./app/*
2023-09-12 12:21:51 +08:00
- cp -r /go/web/build/* ./app/
2023-09-12 14:10:38 +08:00
- 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
2023-09-13 10:05:09 +08:00
- bash bulid.sh
2023-09-25 10:24:55 +08:00
2023-09-25 11:13:41 +08:00
- 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
2023-09-12 14:29:14 +08:00
volumes:
- name: outdir
host:
2023-09-12 16:06:02 +08:00
path: /root/web