Skip to content

Commit 59122a0

Browse files
committed
feat: add webhook-bridge main CLI to build pipeline
- Add cmd/webhook-bridge to GoReleaser configuration - Include webhook-bridge binary in CI build matrix - Update development tools to build all three binaries: - webhook-bridge (main CLI) - webhook-bridge-server (server component) - python-manager (Python executor) - Update Homebrew and Scoop package configurations - Ensure all binaries are included in release artifacts This provides a unified CLI interface for all webhook-bridge operations while maintaining the existing server and python-manager components. Signed-off-by: longhao <[email protected]>
1 parent dceb0d2 commit 59122a0

File tree

7 files changed

+54
-8
lines changed

7 files changed

+54
-8
lines changed

.github/workflows/main-ci.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,23 @@ jobs:
204204
LDFLAGS="${LDFLAGS} -X github.com/loonghao/webhook_bridge/pkg/version.GitCommit=${GIT_COMMIT}"
205205
LDFLAGS="${LDFLAGS} -X github.com/loonghao/webhook_bridge/pkg/version.BuildDate=${BUILD_TIME}"
206206
207-
go build -ldflags "${LDFLAGS}" -o webhook-bridge-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }} ./cmd/server
207+
# Build main CLI
208+
go build -ldflags "${LDFLAGS}" -o webhook-bridge-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }} ./cmd/webhook-bridge
209+
210+
# Build server
211+
go build -ldflags "${LDFLAGS}" -o webhook-bridge-server-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }} ./cmd/server
212+
213+
# Build python manager
214+
go build -ldflags "${LDFLAGS}" -o python-manager-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }} ./cmd/python-manager
208215
209216
- name: Upload artifacts
210217
uses: actions/upload-artifact@v4
211218
with:
212219
name: webhook-bridge-${{ matrix.goos }}-${{ matrix.goarch }}
213220
path: |
214221
webhook-bridge-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}
222+
webhook-bridge-server-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}
223+
python-manager-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.suffix }}
215224
web/static/js/dist/
216225
retention-days: 30
217226

.goreleaser.yml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,38 @@ before:
1212
- go run dev.go proto
1313

1414
builds:
15+
# Main CLI binary (unified command-line interface)
16+
- id: webhook-bridge
17+
main: ./cmd/webhook-bridge
18+
binary: webhook-bridge
19+
goos:
20+
- linux
21+
- windows
22+
- darwin
23+
goarch:
24+
- amd64
25+
- arm64
26+
- arm
27+
goarm:
28+
- 6
29+
- 7
30+
ignore:
31+
# Skip ARM builds for Windows and macOS for now
32+
- goos: windows
33+
goarch: arm
34+
- goos: windows
35+
goarch: arm64
36+
- goos: darwin
37+
goarch: arm
38+
ldflags:
39+
- -s -w
40+
- -X main.version={{.Version}}
41+
- -X main.buildTime={{.Date}}
42+
- -X main.goVersion={{.Env.GOVERSION}}
43+
- -X github.com/loonghao/webhook_bridge/pkg/version.Version={{.Version}}
44+
- -X github.com/loonghao/webhook_bridge/pkg/version.GitCommit={{.Commit}}
45+
- -X github.com/loonghao/webhook_bridge/pkg/version.BuildDate={{.Date}}
46+
1547
# Main server binary
1648
- id: webhook-bridge-server
1749
main: ./cmd/server
@@ -77,6 +109,7 @@ builds:
77109
archives:
78110
- id: webhook-bridge
79111
builds:
112+
- webhook-bridge
80113
- webhook-bridge-server
81114
- python-manager
82115
name_template: >-
@@ -177,8 +210,9 @@ brews:
177210
description: "A hybrid Go/Python webhook bridge for flexible automation"
178211
license: "Apache-2.0"
179212
test: |
180-
system "#{bin}/webhook-bridge-server --version"
213+
system "#{bin}/webhook-bridge --version"
181214
install: |
215+
bin.install "webhook-bridge"
182216
bin.install "webhook-bridge-server"
183217
bin.install "python-manager"
184218

internal/web/modern/dashboard.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ func (h *ModernDashboardHandler) saveConfig(c *gin.Context) {
420420
yamlContent := h.generateYAMLConfig(configUpdate)
421421

422422
// Write to file
423-
if err := os.WriteFile(configPath, []byte(yamlContent), 0644); err != nil {
423+
if err := os.WriteFile(configPath, []byte(yamlContent), 0600); err != nil {
424424
c.JSON(http.StatusInternalServerError, map[string]interface{}{
425425
"success": false,
426426
"error": "Failed to save configuration file",

scripts/setup_python_env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def install_requirements():
4343

4444
try:
4545
logger.info("Installing Python requirements...")
46-
subprocess.run([sys.executable, "-m", "pip", "install", "-r", str(requirements_file)],
46+
subprocess.run([sys.executable, "-m", "pip", "install", "-r", str(requirements_file)],
4747
check=True, capture_output=True, text=True)
4848
logger.info("Requirements installed successfully")
4949
return True

tools/dev/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ func buildProject(args []string) {
261261
generateProto()
262262
}
263263

264+
// Build main CLI
265+
buildBinary("./cmd/webhook-bridge", "webhook-bridge")
266+
264267
// Build server
265268
buildBinary("./cmd/server", "webhook-bridge-server")
266269

webhook_bridge/filesystem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def get_plugin_directories() -> List[str]:
6060

6161
default_dirs = [
6262
"plugins",
63-
"example_plugins",
63+
"example_plugins",
6464
"webhook_plugins",
6565
]
6666

webhook_bridge/plugin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def execute(self) -> Dict[str, Any]:
9393
"http_method": self.http_method,
9494
"result": result,
9595
"plugin_executed": True,
96-
"status": "success"
96+
"status": "success",
9797
}
9898
except Exception as e:
9999
return {
@@ -102,7 +102,7 @@ def execute(self) -> Dict[str, Any]:
102102
"error": str(e),
103103
"traceback": traceback.format_exc(),
104104
"http_method": self.http_method,
105-
"status": "error"
105+
"status": "error",
106106
}
107107

108108
def get_data(self, key: str, default: Any = None) -> Any:
@@ -187,4 +187,4 @@ def execute_plugin(self, plugin_path: str, data: Dict[str, Any],
187187
"""Execute a plugin."""
188188
plugin_class = self.load_plugin(plugin_path)
189189
plugin_instance = plugin_class(data, None, http_method)
190-
return plugin_instance.execute()
190+
return plugin_instance.execute()

0 commit comments

Comments
 (0)