Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
# API Monitor Docker Image CI/CD
# ===================================
# 触发条件:
# - 推送到 main 分支
# - 推送到 main 分支 → latest 标签
# - 推送到其他分支 → dev 标签
# - 创建版本标签(如 v1.0.0)
# - 手动触发(workflow_dispatch)

name: Build and Publish Docker Image

on:
push:
branches: [main]
branches: ["**"] # 所有分支
tags: ["v*"]
paths-ignore:
- "**.md"
Expand Down Expand Up @@ -85,6 +86,10 @@ jobs:
tags: |
# 默认 latest 标签(推送到 main 分支或版本标签时都生成)
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
# dev 标签(非主分支时生成)
type=raw,value=dev,enable=${{ github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/v') }}
# 分支名标签(非主分支时,便于区分不同分支的构建)
type=ref,event=branch,enable=${{ github.ref != 'refs/heads/main' }}
# Git commit SHA(仅在推送到 main 分支时生成)
type=sha,prefix=,enable=${{ github.ref == 'refs/heads/main' }}
# 版本标签(如 v1.0.0 -> 1.0.0)
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ data/
*.db
*.db-journal
*.db-shm
*.db-wal
*.db-wal5

# ====================
# 日志
Expand Down Expand Up @@ -71,7 +71,7 @@ build/
out/
coverage/
stats.html

public/
# ====================
# 备份 & 杂项
# ====================
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
---

**一个全能型的 API 管理与服务器监控面板**。
它不仅能帮您集中管理主机、实时 SSH 终端、Docker 容器监控,还提供了强大的云服务集成功能,包括 Cloudflare、OpenAI、Zeabur、Koyeb、等多种云服务。
它不仅能帮您集中管理主机、实时 终端、Docker 容器监控,还提供了强大的云服务集成功能,包括 Cloudflare、OpenAI、Zeabur、Koyeb、等多种云服务。
同样支持Antigravity / Gemini 的模型转 API 调用,同时有完善的额度使用统计、日志记录、模型列表获取、全链路耗时统计等功能。

[🔵 Docker Hub](https://hub.docker.com/r/iwvw/api-monitor) | [🔴 在线演示 (Demo)](https://api-monitor.zeabur.app/)
Expand Down
60 changes: 60 additions & 0 deletions agent-go/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# API Monitor Agent 构建脚本 (PowerShell)
$VERSION = "0.1.2"
$OUTPUT_DIR = "dist"
$PUBLIC_DIR = "..\public\agent"

# 清理输出目录
if (Test-Path $OUTPUT_DIR) { Remove-Item $OUTPUT_DIR -Recurse -Force }
New-Item -ItemType Directory -Force -Path $OUTPUT_DIR | Out-Null
New-Item -ItemType Directory -Force -Path $PUBLIC_DIR | Out-Null

Write-Host "=== Building API Monitor Agent v$VERSION ===" -ForegroundColor Cyan

# 设置通用的构建参数
$LDFLAGS = "-s -w -X main.VERSION=$VERSION"

# 1. Windows amd64
Write-Host "Building windows-amd64..."
$env:GOOS = "windows"
$env:GOARCH = "amd64"
go build -ldflags $LDFLAGS -o "$OUTPUT_DIR\agent-windows-amd64.exe"
Copy-Item "$OUTPUT_DIR\agent-windows-amd64.exe" "$PUBLIC_DIR\agent-windows-amd64.exe" -Force
# 兼容旧版脚本的备用名
Copy-Item "$OUTPUT_DIR\agent-windows-amd64.exe" "$PUBLIC_DIR\am-agent-win.exe" -Force

# 2. Linux amd64
Write-Host "Building linux-amd64..."
$env:GOOS = "linux"
$env:GOARCH = "amd64"
go build -ldflags $LDFLAGS -o "$OUTPUT_DIR\agent-linux-amd64"
Copy-Item "$OUTPUT_DIR\agent-linux-amd64" "$PUBLIC_DIR\agent-linux-amd64" -Force

# 3. Linux arm64
Write-Host "Building linux-arm64..."
$env:GOOS = "linux"
$env:GOARCH = "arm64"
go build -ldflags $LDFLAGS -o "$OUTPUT_DIR\agent-linux-arm64"
Copy-Item "$OUTPUT_DIR\agent-linux-arm64" "$PUBLIC_DIR\agent-linux-arm64" -Force

# 4. macOS amd64
Write-Host "Building darwin-amd64..."
$env:GOOS = "darwin"
$env:GOARCH = "amd64"
go build -ldflags $LDFLAGS -o "$OUTPUT_DIR\agent-darwin-amd64"
Copy-Item "$OUTPUT_DIR\agent-darwin-amd64" "$PUBLIC_DIR\agent-darwin-amd64" -Force

# 5. macOS arm64
Write-Host "Building darwin-arm64..."
$env:GOOS = "darwin"
$env:GOARCH = "arm64"
go build -ldflags $LDFLAGS -o "$OUTPUT_DIR\agent-darwin-arm64"
Copy-Item "$OUTPUT_DIR\agent-darwin-arm64" "$PUBLIC_DIR\agent-darwin-arm64" -Force

# 恢复环境变量
$env:GOOS = $null
$env:GOARCH = $null

Write-Host "=== Build Complete ===" -ForegroundColor Green
Write-Host "Output Directory: $OUTPUT_DIR"
Write-Host "Public Directory: $PUBLIC_DIR"
Get-ChildItem $PUBLIC_DIR | Select-Object Name, @{Name="Size(KB)";Expression={[math]::round($_.Length / 1KB, 2)}}
2 changes: 2 additions & 0 deletions agent-go/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ require (
)

require (
github.com/UserExistsError/conpty v0.1.4 // indirect
github.com/creack/pty v1.1.24 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
Expand Down
4 changes: 4 additions & 0 deletions agent-go/go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
github.com/UserExistsError/conpty v0.1.4 h1:+3FhJhiqhyEJa+K5qaK3/w6w+sN3Nh9O9VbJyBS02to=
github.com/UserExistsError/conpty v0.1.4/go.mod h1:PDglKIkX3O/2xVk0MV9a6bCWxRmPVfxqZoTG/5sSd9I=
github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
Loading
Loading