fix(ci): runner 无 go 自举、发版流水线与文档绝对链接
sdk-ci / test (push) Failing after 10s

- ci 加 actions/setup-go(此前 runner 无 go 直接失败);交叉编译笔误修正
- 新增 release.yml(v* tag:发布前测试 + Gitea Release + 源码包附件 +
  发版成功后清理失败 action 记录)
- README 相对链接(../EntitleForge)在 Gitea 网页 404 → 绝对 URL
This commit is contained in:
iceking2nd committed 2026-11-09 18:09:57 +08:00
1 parent 81c7295893
commit 10c66cc30e
3 files changed
+70 -2

No files matched your search

+5
View File
@@ -4,6 +4,7 @@ name: sdk-ci
on: on:
push: push:
branches: ["*"] branches: ["*"]
tags: ["v*"]
pull_request: pull_request:
env: env:
@@ -14,6 +15,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.27"
mirror: https://mirrors.aliyun.com/golang/
- name: 全量测试(race + shuffle) - name: 全量测试(race + shuffle)
run: go test -race -shuffle=on ./... run: go test -race -shuffle=on ./...
- name: 依赖闭包断言(零第三方依赖红线) - name: 依赖闭包断言(零第三方依赖红线)
+63
View File
@@ -0,0 +1,63 @@
# 益铸 EntitleForge SDK 发布流水线(仅 v* tag 触发)。
# go module 库的"发版"即 git tag(客户 go get 直接引用);此流水线补齐:
# Gitea Release 记录 + 源码包附件,成功后清理失败的 action 记录。
name: sdk-release
on:
push:
tags: ["v*"]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.27"
mirror: https://mirrors.aliyun.com/golang/
- name: 发布前测试(tag 必须指向全绿代码)
run: go test -race -shuffle=on ./...
- name: 创建 Release 并上传源码包
env:
GITEA_TOKEN: ${{ secrets.GITEA_PERSONAL_ACCESS_TOKEN }}
run: |
set -eu
API="${GITHUB_SERVER_URL}/api/v1"
REPO="${GITHUB_REPOSITORY}"
VERSION="${GITHUB_REF_NAME}"
tar -czf "entitleforge-sdk-${VERSION}.tar.gz" --exclude='.git' .
PAYLOAD=$(printf '{"tag_name":"%s","name":"益铸 EntitleForge SDK %s","body":"go get %s@%s(零第三方依赖)","draft":false,"prerelease":false}' \
"${VERSION}" "${VERSION}" "${REPO,,}" "${VERSION}")
curl -sS -X POST -H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" -d "${PAYLOAD}" \
"${API}/repos/${REPO}/releases" >/dev/null
echo "Release ${VERSION} 创建完成(go get 引用即发版本体)"
# 发版成功后清理失败的 action 记录
cleanup:
needs: release
if: success()
runs-on: ubuntu-latest
steps:
- name: 清理失败的 workflow runs
env:
GITEA_TOKEN: ${{ secrets.GITEA_PERSONAL_ACCESS_TOKEN }}
run: |
set -eu
API="${GITHUB_SERVER_URL}/api/v1"
REPO="${GITHUB_REPOSITORY}"
PAGE=1
while :; do
RUNS=$(curl -sS -H "Authorization: token ${GITEA_TOKEN}" "${API}/repos/${REPO}/actions/tasks?limit=50&page=${PAGE}")
TOTAL=$(echo "${RUNS}" | python3 -c "import json,sys; print(json.load(sys.stdin).get('total_count',0))")
echo "${RUNS}" | python3 -c "import json,sys; [print(r['url']) for r in json.load(sys.stdin).get('workflow_runs',[]) if r.get('status')=='failure']" | while read -r url; do
RUN_API=$(echo "${url}" | sed "s|${GITHUB_SERVER_URL}/\\(.*\\)/actions/runs/|${API}/repos/\\1/actions/runs/|")
echo "删除失败 run: ${url}"
curl -sS -o /dev/null -X DELETE -H "Authorization: token ${GITEA_TOKEN}" "${RUN_API}"
done
[ "$((PAGE * 50))" -ge "${TOTAL}" ] && break
PAGE=$((PAGE + 1))
done
echo "失败 action 清理完成"
+2 -2
View File
@@ -2,7 +2,7 @@
益铸(EntitleForge)授权管理系统的客户端 SDK——**零第三方依赖**(纯 Go 标准库)。 益铸(EntitleForge)授权管理系统的客户端 SDK——**零第三方依赖**(纯 Go 标准库)。
服务端与控制台见 [EntitleForge 主仓](../EntitleForge)。 服务端与控制台见 [EntitleForge 主仓](https://git.wxccs.org/EntitleForge/EntitleForge)。
## 引入 ## 引入
@@ -57,7 +57,7 @@ client.Check("module.x") // (bool, Reason)——GRACE/EXPIRED/REVO
## 与服务端的关系 ## 与服务端的关系
本仓的 `license`/`crypto` 是协议实现的**单一归属**——服务端(EntitleForge 主仓)反向依赖本仓, 本仓的 `license`/`crypto` 是协议实现的**单一归属**——服务端(EntitleForge 主仓)反向依赖本仓,
杜绝两套实现漂移([设计文档 §2](../EntitleForge/docs/design/07-sdk.md))。 杜绝两套实现漂移([设计文档 §2](https://git.wxccs.org/EntitleForge/EntitleForge/blob/main/docs/design/07-sdk.md))。
## 开发 ## 开发