fix(ci): deploy-server 编译前给私有依赖 github.com/wangjia/codes 配 gitea 鉴权
Deploy Server / deploy-server (push) Successful in 4m17s
Deploy Server / deploy-server (push) Successful in 4m17s
冷缓存 runner 上 go build 拉私有 codes 依赖时,GOPROXY=goproxy.cn 对私有仓 404 → 回退 direct git 到 github.com → 无凭证失败(server-v1.1.0 首发在此挂,44s Compile 步红)。 加一步:GOPRIVATE + git insteadOf 把 github.com/wangjia/codes 重写到自建 gitea 并注入 FORGEJO_TOKEN(已验证 oauth2:<token> basic-auth 可 ls-remote 到 pin 的 commit)。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A79VtQA1BwTuQN1ThpvYpo
This commit is contained in:
@@ -37,6 +37,21 @@ jobs:
|
||||
export PATH=/usr/local/go/bin:$PATH
|
||||
go version
|
||||
|
||||
# go.mod 依赖 github.com/wangjia/codes 的真源是自建私有 gitea(GOPROXY=goproxy.cn
|
||||
# 对私有仓返 404 → 回退 direct git 到 github.com → 无凭证 terminal-prompts-disabled
|
||||
# 失败)。这里把 go 对该路径的拉取重写到 gitea 并注入 token(oauth2:<token>
|
||||
# basic-auth),GOPRIVATE 让 go 跳过公共 proxy/sumdb 直接走 git。runner 模块缓存
|
||||
# 为热时不触发此路径,冷缓存(如换 runner/清缓存)必需。
|
||||
- name: 私有依赖鉴权(github.com/wangjia/codes → 自建 gitea)
|
||||
env:
|
||||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||||
FORGEJO_URL: ${{ secrets.FORGEJO_URL }}
|
||||
run: |
|
||||
proto="${FORGEJO_URL%%://*}"
|
||||
host="${FORGEJO_URL#*://}"
|
||||
git config --global url."${proto}://oauth2:${FORGEJO_TOKEN}@${host}/wangjia/codes.git".insteadOf "https://github.com/wangjia/codes"
|
||||
echo "GOPRIVATE=github.com/wangjia/codes" >> "$GITHUB_ENV"
|
||||
|
||||
# 直接在 runner 跑(不嵌套 docker,避免 DinD 挂载失败;go 由上一步装好)。
|
||||
- name: Compile (Go 控制面)
|
||||
run: bash scripts/ci/compile-backend.sh
|
||||
|
||||
Reference in New Issue
Block a user