Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 50c44ddc2d | |||
| ad34cbeab3 | |||
| 38644bf5a9 |
@@ -56,7 +56,27 @@ jobs:
|
||||
|
||||
- name: Install Bun
|
||||
run: |
|
||||
GITHUB="https://ghproxy.net/https://github.com" curl -fsSL https://bun.sh/install | bash
|
||||
case "$(uname -m)" in
|
||||
x86_64)
|
||||
BUN_ARCH="x64"
|
||||
;;
|
||||
aarch64|arm64)
|
||||
BUN_ARCH="aarch64"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported architecture: $(uname -m)"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
BUN_ASSET="bun-linux-${BUN_ARCH}.zip"
|
||||
BUN_MIRROR_URL="https://ghproxy.net/https://github.com/oven-sh/bun/releases/latest/download/${BUN_ASSET}"
|
||||
|
||||
curl -fL --retry 3 --retry-delay 5 "$BUN_MIRROR_URL" -o /tmp/bun.zip
|
||||
rm -rf "$HOME/.bun"
|
||||
mkdir -p "$HOME/.bun/bin"
|
||||
unzip -qo /tmp/bun.zip -d /tmp
|
||||
install -m 0755 "/tmp/bun-linux-${BUN_ARCH}/bun" "$HOME/.bun/bin/bun"
|
||||
echo "$HOME/.bun/bin" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Install dependencies
|
||||
|
||||
@@ -248,6 +248,7 @@ docker compose down
|
||||
| `bun run start` | 直接运行 `src/server.ts` |
|
||||
| `bun run start:prod` | 先类型检查再启动 |
|
||||
| `bun run install:opencode` | 手动安装 `.opencode` 依赖 |
|
||||
| `bun run pipeline:trigger` | 通过更新远端 tag 触发 Gitea CI/CD(默认优先 `gitea`,否则回退到 `origin`;tag=`latest`) |
|
||||
|
||||
### 模型与 API 配置
|
||||
|
||||
@@ -309,5 +310,3 @@ OPENCODE_CLIENT_BASE_URL=http://127.0.0.1:4096
|
||||
```
|
||||
|
||||
配置后,`TJWaterAgent` 会连接该外部 opencode server,而不是自行启动 embedded opencode server。
|
||||
|
||||
兼容说明:历史环境变量 `OPENCODE_BASE_URL` 仍可使用,但建议迁移为 `OPENCODE_CLIENT_BASE_URL`,并显式设置 `OPENCODE_MODE=client`。
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
"dev": "bun --watch src/server.ts",
|
||||
"build": "bun run check",
|
||||
"check": "bun run typecheck && bun run typecheck:opencode",
|
||||
"push": "git add . && git commit -m \"chore: update\" && git push origin main",
|
||||
"pipeline:trigger": "bash scripts/trigger-gitea-pipeline.sh",
|
||||
"start": "bun src/server.ts",
|
||||
"start:prod": "bun run check && bun src/server.ts"
|
||||
},
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
|
||||
echo "Usage: bash scripts/trigger-gitea-pipeline.sh [remote] [tag]"
|
||||
echo ""
|
||||
echo "Examples:"
|
||||
echo " bash scripts/trigger-gitea-pipeline.sh"
|
||||
echo " bash scripts/trigger-gitea-pipeline.sh gitea latest"
|
||||
echo " bash scripts/trigger-gitea-pipeline.sh origin latest"
|
||||
echo " bash scripts/trigger-gitea-pipeline.sh gitea v2026.05.15.1"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
resolve_default_remote() {
|
||||
if git remote get-url gitea >/dev/null 2>&1; then
|
||||
echo "gitea"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if git remote get-url origin >/dev/null 2>&1; then
|
||||
echo "origin"
|
||||
return 0
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
REMOTE="${1:-}"
|
||||
TAG="${2:-latest}"
|
||||
|
||||
if ! git rev-parse --git-dir >/dev/null 2>&1; then
|
||||
echo "[ERROR] Current directory is not a git repository."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$REMOTE" ]]; then
|
||||
if ! REMOTE="$(resolve_default_remote)"; then
|
||||
echo "[ERROR] No default remote found. Expected 'gitea' or 'origin'."
|
||||
echo "Available remotes:"
|
||||
git remote -v || true
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! git remote get-url "$REMOTE" >/dev/null 2>&1; then
|
||||
echo "[ERROR] Remote '$REMOTE' does not exist."
|
||||
echo "Available remotes:"
|
||||
git remote -v
|
||||
exit 1
|
||||
fi
|
||||
|
||||
HEAD_SHA="$(git rev-parse --short HEAD)"
|
||||
MESSAGE="manual trigger: ${TAG} $(date '+%F %T')"
|
||||
|
||||
echo "[INFO] HEAD: ${HEAD_SHA}"
|
||||
echo "[INFO] Recreate annotated tag '${TAG}'"
|
||||
git tag -fa "$TAG" -m "$MESSAGE"
|
||||
|
||||
echo "[INFO] Push '${TAG}' to remote '${REMOTE}' (force update)"
|
||||
git push "$REMOTE" "refs/tags/${TAG}" --force
|
||||
|
||||
echo "[INFO] Verify remote tag reference"
|
||||
git ls-remote --tags "$REMOTE" "refs/tags/${TAG}"
|
||||
|
||||
echo "[DONE] Pipeline trigger request sent by updating tag '${TAG}'."
|
||||
+1
-5
@@ -122,11 +122,7 @@ const normalizedEnv = {
|
||||
...process.env,
|
||||
OPENCODE_MODE:
|
||||
process.env.OPENCODE_MODE ??
|
||||
(process.env.OPENCODE_CLIENT_BASE_URL || process.env.OPENCODE_BASE_URL
|
||||
? "client"
|
||||
: "embedded"),
|
||||
OPENCODE_CLIENT_BASE_URL:
|
||||
process.env.OPENCODE_CLIENT_BASE_URL ?? process.env.OPENCODE_BASE_URL,
|
||||
(process.env.OPENCODE_CLIENT_BASE_URL ? "client" : "embedded"),
|
||||
};
|
||||
|
||||
export const config: AppConfig = envSchema.parse(normalizedEnv);
|
||||
|
||||
Reference in New Issue
Block a user