3 Commits
Author SHA1 Message Date
admin 81e47d4b12 fix: 镜像与 release 都带上 xbctl
Build way-node / Build and Push (push) Successful in 1m10s
装 way-node 时报:
  curl: (22) The requested URL returned error: 404
  [ERROR] Failed to download xbctl from .../releases/download/<tag>/xbctl-linux-amd64

install.sh 除了 way-node 还要下 xbctl(配套 CLI),而 Dockerfile 只编了
way-node、release 也只挂了 way-node 资产。

- Dockerfile: builder 阶段同时 go build cmd/xbctl,运行时 COPY 进 /usr/local/bin
- workflow: extract 步骤从镜像里把 xbctl 也 cp 出来
- workflow: release 上传改成循环,way-node 与 xbctl 各挂一个资产
2026-11-27 12:10:33 +08:00
admin b7e079ac14 fix(ci): release id 解析取顶层字段
Build way-node / Build and Push (push) Successful in 1m14s
上一轮日志显示 '✓ 资产已上传: .../releases/1',RID 解析成了 1。
Gitea 的 release JSON 里 "id" 出现多次(顶层、author.id、repo.id),
按逗号拆行后用 ^"id": 锚定行首匹配不到(首行是 {"id":458 带花括号),
改回 grep -o '"id":[0-9]*' | head -1 —— 顶层 id 总是最先出现。

已用真实 API 验证:
  /releases/tags/20261127-66caaba → 解析出 458 ✓

同时补上了 release 458 缺失的 way-node-linux-amd64 资产(手动)。
2026-11-27 11:48:58 +08:00
admin 66caaba5bc fix: install.sh 兼容 Gitea 下载路径 + CI 补 curl
Build way-node / Build and Push (push) Successful in 1m16s
1) install.sh: Gitea 不支持 GitHub 的 /releases/latest/download/ 简写
   (实测 404),改成先用 Gitea API /releases/latest 查 tag_name,
   再拼 /releases/download/<tag>/<artifact>(实测 200,66875554 bytes)。
   解析用 sed,不依赖 jq/python。

2) CI: 上一轮 release 上传静默失败,日志是
   '/root/.cache/act/.../7.sh: line 6: curl: command not found'
   根因是装 curl 的语句写在 'if ! command -v docker' 里面,
   而 docker 本来就存在(runner 挂了 docker.sock),整段被跳过。
   现在 curl 单独检查安装;release id 解析也从 python3 换成 sed。
2026-11-27 11:46:19 +08:00
3 changed files with 43 additions and 12 deletions
+28 -10
View File
@@ -30,16 +30,25 @@ jobs:
name: Build and Push
runs-on: ubuntu
steps:
- name: Install Docker CLI
- name: Install Docker CLI and curl
run: |
# docker 通常已存在(挂 docker.sock),所以 curl 要单独保证 —— 上一轮
# 就是因为整段 if 被跳过、curl 缺失,release 上传那步静默失败
if ! command -v docker >/dev/null 2>&1; then
if command -v apk >/dev/null 2>&1; then
apk add --no-cache docker-cli git curl
apk add --no-cache docker-cli git
elif command -v apt-get >/dev/null 2>&1; then
apt-get update && apt-get install -y docker.io git curl
apt-get update && apt-get install -y docker.io git
fi
fi
docker --version
if ! command -v curl >/dev/null 2>&1; then
if command -v apk >/dev/null 2>&1; then
apk add --no-cache curl
elif command -v apt-get >/dev/null 2>&1; then
apt-get update && apt-get install -y curl
fi
fi
docker --version && curl --version | head -1
- name: Checkout
uses: actions/checkout@v4
@@ -83,8 +92,9 @@ jobs:
# install.sh 需要独立二进制,直接从刚构建的镜像里取,避免二次编译
CID=$(docker create "${{ env.IMAGE }}:latest")
docker cp "$CID:/usr/local/bin/way-node" way-node-linux-amd64
docker cp "$CID:/usr/local/bin/xbctl" xbctl-linux-amd64
docker rm -f "$CID" >/dev/null
ls -lh way-node-linux-amd64 | awk '{print " way-node-linux-amd64", $5}'
ls -lh way-node-linux-amd64 xbctl-linux-amd64 | awk '{print " " $9, $5}'
- name: Upload binary to release
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master'
@@ -96,14 +106,22 @@ jobs:
curl -sS -X POST -H "$AUTH" -H "Content-Type: application/json" \
-d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\",\"body\":\"way-node ${TAG}\",\"target_commitish\":\"${{ github.sha }}\"}" \
"${API}/releases" -o /tmp/rel.json || true
RID=$(python3 -c "import json;print(json.load(open('/tmp/rel.json')).get('id',''))" 2>/dev/null || echo "")
# Gitea 的 release JSON 里 "id" 会出现多次(author.id、repo.id…),
# 必须先按逗号拆行,只取顶层那个 "id",否则会拿到 1
# 顶层 "id" 在 Gitea 的 release JSON 里是最先出现的那个(后面 author.id/repo.id 才是 1)
rid_of() { grep -o '"id":[0-9]*' | head -1 | cut -d: -f2; }
RID=$(rid_of < /tmp/rel.json 2>/dev/null)
if [ -z "$RID" ]; then
RID=$(curl -sS -H "$AUTH" "${API}/releases/tags/${TAG}" | python3 -c "import json,sys;print(json.load(sys.stdin).get('id',''))" 2>/dev/null || echo "")
RID=$(curl -sS -H "$AUTH" "${API}/releases/tags/${TAG}" | rid_of)
fi
echo " 解析到 release id: ${RID}"
if [ -n "$RID" ]; then
curl -sS -X POST -H "$AUTH" -F "attachment=@way-node-linux-amd64" \
"${API}/releases/${RID}/assets?name=way-node-linux-amd64" >/dev/null \
&& echo " ✓ 资产已上传: ${API}/releases/${RID}"
for asset in way-node-linux-amd64 xbctl-linux-amd64; do
[ -f "$asset" ] || { echo " ⚠ 缺少 $asset,跳过"; continue; }
curl -sS -X POST -H "$AUTH" -F "attachment=@${asset}" \
"${API}/releases/${RID}/assets?name=${asset}" >/dev/null \
&& echo " ✓ 已上传资产 ${asset}"
done
else
echo " ⚠ release 创建失败,二进制未上传(镜像已推送,docker 部署不受影响)"
fi
+4 -1
View File
@@ -14,7 +14,9 @@ RUN CGO_ENABLED=0 go build -ldflags "-s -w \
-X main.version=$(git describe --tags --always --dirty 2>/dev/null || echo dev) \
-X main.buildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-tags "with_quic with_utls with_wireguard with_clash_api" \
-o way-node ./cmd/way-node
-o way-node ./cmd/way-node && \
CGO_ENABLED=0 go build -ldflags "-s -w" \
-o xbctl ./cmd/xbctl
# Runtime stage — sing-box & xray-core are embedded as Go libraries
FROM alpine:3.20
@@ -22,6 +24,7 @@ FROM alpine:3.20
RUN apk add --no-cache ca-certificates tzdata
COPY --from=builder /build/way-node /usr/local/bin/way-node
COPY --from=builder /build/xbctl /usr/local/bin/xbctl
RUN mkdir -p /etc/way-node
+11 -1
View File
@@ -483,7 +483,17 @@ select_binary_source() {
resolve_download_url() {
local artifact="$1"
if [ "$RELEASE_VERSION" = "latest" ]; then
DOWNLOAD_URL="${DEFAULT_DOWNLOAD_BASE}/latest/download/${artifact}"
# Gitea 不支持 GitHub 那种 /releases/latest/download/ 简写,先用 API 查最新 tag
local api_base tag
api_base="${DEFAULT_DOWNLOAD_BASE%/releases}"
api_base="${api_base%/download}"
case "$api_base" in
*"/admin/"*) api_base="$(printf '%s' "$api_base" | sed -E 's#^(https?://[^/]+)/(.*)$#\1/api/v1/repos/\2#')" ;;
esac
tag="$(curl -fsSL --max-time 10 "${api_base}/releases/latest" 2>/dev/null \
| sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' | head -1)"
[ -n "$tag" ] || tag="v1.0.0"
DOWNLOAD_URL="${DEFAULT_DOWNLOAD_BASE}/download/${tag}/${artifact}"
else
DOWNLOAD_URL="${DEFAULT_DOWNLOAD_BASE}/download/${RELEASE_VERSION}/${artifact}"
fi