Skip to content

Commit b8db1fd

Browse files
authored
fix: adapt to new convention (#253)
1 parent 5accb45 commit b8db1fd

File tree

10 files changed

+131
-125
lines changed

10 files changed

+131
-125
lines changed
Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
name: 最新版
1+
name: Build
22

33
on:
4-
workflow_run:
5-
workflows: [PushLint, PullLint]
6-
types:
7-
- completed
4+
workflow_call:
5+
inputs:
6+
prefix:
7+
type: string
8+
required: true
9+
upload_artifact:
10+
type: boolean
11+
required: true
812

913
env:
10-
BINARY_PREFIX: "zbppg_"
11-
BINARY_SUFFIX: ""
14+
BINARY_SUFFIX: "${{ inputs.prefix }}"
1215
PR_PROMPT: "::warning:: Build artifact will not be uploaded due to the workflow is trigged by pull request."
1316
LD_FLAGS: "-w -s"
1417

1518
jobs:
1619
build:
1720
name: Build binary CI
1821
runs-on: ubuntu-latest
19-
if: ${{ github.event.workflow_run.conclusion == 'success' }}
2022
strategy:
2123
matrix:
2224
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/amd64, darwin/arm64
@@ -34,10 +36,12 @@ jobs:
3436
- uses: actions/checkout@master
3537
with:
3638
fetch-depth: 0
39+
3740
- name: Setup Go environment
3841
uses: actions/setup-go@master
3942
with:
4043
go-version: '^1.25'
44+
4145
- name: Cache downloaded module
4246
uses: actions/cache@master
4347
continue-on-error: true
@@ -46,21 +50,25 @@ jobs:
4650
~/.cache/go-build
4751
~/go/pkg/mod
4852
key: ${{ runner.os }}-go-${{ matrix.goos }}-${{ matrix.goarch }}-${{ hashFiles('**/go.sum') }}
53+
4954
- name: Build binary file
5055
env:
5156
GOOS: ${{ matrix.goos }}
5257
GOARCH: ${{ matrix.goarch }}
53-
IS_PR: ${{ !!github.head_ref }}
58+
IS_PR: ${{ !inputs.upload_artifact }}
59+
BINARY_PREFIX: ${{ inputs.BINARY_PREFIX }}
5460
run: |
5561
GOOS= GOARCH= go generate ./...
5662
if [ $GOOS = "windows" ]; then export BINARY_SUFFIX="$BINARY_SUFFIX.exe"; fi
5763
if $IS_PR ; then echo $PR_PROMPT; fi
5864
export BINARY_NAME="$BINARY_PREFIX$GOOS_$GOARCH$BINARY_SUFFIX"
5965
export CGO_ENABLED=0
66+
go generate main.go
6067
go build -o "output/$BINARY_NAME" -trimpath -ldflags "$LD_FLAGS" .
68+
6169
- name: Upload artifact
6270
uses: actions/upload-artifact@master
63-
if: ${{ !github.head_ref }}
71+
if: ${{ inputs.upload_artifact }}
6472
with:
6573
name: ${{ matrix.goos }}_${{ matrix.goarch }}
6674
path: output/

.github/workflows/pull.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,10 @@ jobs:
3333
uses: ./.github/workflows/lib_run.yml
3434
with:
3535
ref: ${{ github.event.pull_request.head.sha }}
36+
37+
build:
38+
needs: [runmain]
39+
uses: ./.github/workflows/lib_build.yml
40+
with:
41+
prefix: "zbppg_"
42+
upload_artifact: false

.github/workflows/push.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,10 @@ jobs:
1818
uses: ./.github/workflows/lib_run.yml
1919
with:
2020
ref: main
21+
22+
build:
23+
needs: [runmain]
24+
uses: ./.github/workflows/lib_build.yml
25+
with:
26+
prefix: "zbppg_"
27+
upload_artifact: true

README-Edit.md

Lines changed: 0 additions & 80 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
## 完善教程
2020
目前开发教程还不是很全面,欢迎大家编辑此README完善它,让更多人轻松加入zbp大家庭!
2121

22-
目前提供的样板有 example 中的
22+
目前提供的教程有
2323

24-
- [江林版本](example/JiangRed/message.go)
25-
- [小锅饭版本](example/xiaoguofan/example.go)
24+
- [江林版本](plugin/exJiangRed/message.go)
25+
- [小锅饭版本](plugin/exXiaoGuoFan/example.go)
2626
- [小锅饭的ZerobotCourse](https://github.com/guohuiyuan/ZerobotCourse)
2727
- [夹子的版本(半成品)](doc)

abineundo/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ const (
5252

5353
var (
5454
priore = regexp.MustCompile(`^\t// -{28}(高|中|低)优先级区-{28} //$`)
55-
mainpluginre = regexp.MustCompile(`^\t_ "github\.com/FloatTech/ZeroBot-Plugin/plugin/(\w+)"\s+// `)
56-
custpluginre = regexp.MustCompile(`^\t_ "github\.com/FloatTech/ZeroBot-Plugin/custom/plugin/(\w+)"\s+// `)
55+
mainpluginre = regexp.MustCompile(`^\t_ "github\.com/FloatTech/ZeroBot-Plugin-Playground/plugin/(\w+)"\s+// `)
56+
custpluginre = regexp.MustCompile(`^\t_ "github\.com/FloatTech/ZeroBot-Plugin-Playground/custom/plugin/(\w+)"\s+// `)
5757
)
5858

5959
func init() {

doc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@
3939
## 引用
4040

4141
- [ZerobotCourse](https://github.com/guohuiyuan/ZerobotCourse)
42-
- [example/JiangRed](example/JiangRed/message.go)
42+
- [plugin/exJiangRed](plugin/exJiangRed/message.go)
4343
- [khl.py](https://github.com/TWT233/khl.py)

main.go

Lines changed: 93 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,101 @@ import (
1919

2020
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/abineundo" // 设置插件优先级&更改控制台属性
2121

22-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/example/JiangRed"
23-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/example/xiaoguofan"
24-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/anotherfortune"
25-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/chatgpt"
26-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/chinesebqb"
27-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/cybercat"
28-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/draw" // 服务详情
29-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/fadian"
30-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/fgopickup"
31-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/fyzhq"
32-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/games"
33-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/klala" // 星穹铁道面板/图鉴插件
34-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/kokomi"
35-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/moegozh"
36-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/movies"
37-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/ottoshout"
38-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/partygame"
39-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/playwright"
40-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/qqci"
41-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/qqclean"
42-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/recall" // SGK2401
43-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/rsshub"
44-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/slash"
45-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/subweibo"
46-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/tgyj"
47-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/vote"
48-
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/youdaotranslate"
49-
50-
// 程序主体
22+
// ---------以下插件均可通过前面加 // 注释,注释后停用并不加载插件--------- //
23+
// ----------------------插件优先级按顺序从高到低---------------------- //
24+
// //
25+
// //
26+
// //
27+
// //
28+
// //
29+
// ----------------------------高优先级区---------------------------- //
30+
// vvvvvvvvvvvvvvvvvvvvvvvvvvvv高优先级区vvvvvvvvvvvvvvvvvvvvvvvvvvvv //
31+
// vvvvvvvvvvvvvv高优先级区vvvvvvvvvvvvvv //
32+
// vvvvvvv高优先级区vvvvvvv //
33+
// vvvvvvvvvvvvvv //
34+
// vvvv //
35+
36+
// ^^^^ //
37+
// ^^^^^^^^^^^^^^ //
38+
// ^^^^^^^高优先级区^^^^^^^ //
39+
// ^^^^^^^^^^^^^^高优先级区^^^^^^^^^^^^^^ //
40+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^高优先级区^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
41+
// ----------------------------高优先级区---------------------------- //
42+
// //
43+
// //
44+
// //
45+
// //
46+
// //
47+
// ----------------------------中优先级区---------------------------- //
48+
// vvvvvvvvvvvvvvvvvvvvvvvvvvvv中优先级区vvvvvvvvvvvvvvvvvvvvvvvvvvvv //
49+
// vvvvvvvvvvvvvv中优先级区vvvvvvvvvvvvvv //
50+
// vvvvvvv中优先级区vvvvvvv //
51+
// vvvvvvvvvvvvvv //
52+
// vvvv //
53+
54+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/anotherfortune" // 另一个今日人品
55+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/chatgpt" // ChatGPT对话
56+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/chinesebqb" // 表情包
57+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/cybercat" // 云养猫
58+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/draw" // 服务详情
59+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/exJiangRed" // 江林的插件编写教学
60+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/exXiaoGuoFan" // 小锅饭的示例
61+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/fadian" // 每日发癫
62+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/fgopickup" // FGO卡池查询
63+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/fyzhq" // 发音转换器
64+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/games" // 游戏系统
65+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/klala" // 星穹铁道面板/图鉴查询
66+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/kokomi" // 原神面板查询
67+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/moegozh" // VITS模型拟声迫真中文
68+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/movies" // 电影查询
69+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/ottoshout" // otto鬼叫
70+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/partygame" // 轮盘赌
71+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/playwright" // 网页截图
72+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/qqci" // 简易CI/CD
73+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/qqclean" // QQ号清理
74+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/recall" // 回复撤回
75+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/rsshub" // RssHub订阅
76+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/slash" // Slash自交互
77+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/subweibo" // 订阅微博消息
78+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/tgyj" // 同归于尽
79+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/vote" // 投票
80+
_ "github.com/FloatTech/ZeroBot-Plugin-Playground/plugin/youdaotranslate" // 有道翻译
81+
82+
// _ "github.com/FloatTech/ZeroBot-Plugin/plugin/wtf" // 鬼东西
83+
84+
// ^^^^ //
85+
// ^^^^^^^^^^^^^^ //
86+
// ^^^^^^^中优先级区^^^^^^^ //
87+
// ^^^^^^^^^^^^^^中优先级区^^^^^^^^^^^^^^ //
88+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^中优先级区^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
89+
// ----------------------------中优先级区---------------------------- //
90+
// //
91+
// //
92+
// //
93+
// //
94+
// //
95+
// ----------------------------低优先级区---------------------------- //
96+
// vvvvvvvvvvvvvvvvvvvvvvvvvvvv低优先级区vvvvvvvvvvvvvvvvvvvvvvvvvvvv //
97+
// vvvvvvvvvvvvvv低优先级区vvvvvvvvvvvvvv //
98+
// vvvvvvv低优先级区vvvvvvv //
99+
// vvvvvvvvvvvvvv //
100+
// vvvv //
101+
102+
// ^^^^ //
103+
// ^^^^^^^^^^^^^^ //
104+
// ^^^^^^^低优先级区^^^^^^^ //
105+
// ^^^^^^^^^^^^^^低优先级区^^^^^^^^^^^^^^ //
106+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^低优先级区^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
107+
// ----------------------------低优先级区---------------------------- //
108+
// //
109+
// //
110+
// //
111+
// //
112+
// //
113+
// -----------------------以下为内置依赖,勿动------------------------ //
51114
zero "github.com/wdvxdr1123/ZeroBot"
52115
"github.com/wdvxdr1123/ZeroBot/driver"
116+
// -----------------------以上为内置依赖,勿动------------------------ //
53117
)
54118

55119
type zbpcfg struct {

0 commit comments

Comments
 (0)