Skip to content
Back to skills

Facet Release

BSecurity

Facet 项目发版全流程:版本号同步、发布说明、全量回归、verify 上报、CI 发布(GitHub Release / PyPI / Docker Hub)、生产容器切换、官网版本联动。当用户要求「发版」「发布新版本」「打 tag」「发 1.1.x」时使用。

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 5, 2026
ai-agentspythongobashdockergitapidatabase

Works with

  • api

Security analysis

B76/100
  • mediumUses curl or wget to download content
  • criticalAccesses sensitive system or user directories
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned December 5, 2026

npx -y skills add hsliuping/Facet --skill facet-release --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Facet Release?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Facet Release
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/hsliuping-facet-release/badge)](https://www.skillsdirectory.com/skills/hsliuping-facet-release)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: facet-release
description: Facet 项目发版全流程:版本号同步、发布说明、全量回归、verify 上报、CI 发布(GitHub Release / PyPI / Docker Hub)、生产容器切换、官网版本联动。当用户要求「发版」「发布新版本」「打 tag」「发 1.1.x」时使用。
---

# Facet 发版流程

本技能固化 Facet 从「决定发版」到「生产 + 官网全部对齐」的完整动作序列。
每一步都来自真实发版记录(v1.0.1 → v1.1.3),按顺序执行,不要跳步;
每一步做完都如实记录结果,测试没跑过不能声称通过。

## 发版前必答的三个问题

动手前先向用户确认:

1. **版本号**:递增 patch(1.1.3 → 1.1.4)还是用户指定?
2. **发布内容**:`git log v<上一版>..HEAD --oneline` 盘点,确认哪些进发布说明。
3. **生产是否跟随**:生产容器(118.89.187.218 的 `facet-router`)要不要切到新镜像;
   官网(`D:\code\facet-website`)版本号要不要联动。(默认两者都要。)

## 第 1 步 · 版本号三处同步

三个文件必须一致,漏一处 verify.py 会拦:

| 文件 | 位置 |
|---|---|
| `pyproject.toml` | `version = "x.y.z"` |
| `src/facet/__init__.py` | `__version__ = "x.y.z"` |
| `src/facet/gateway/__init__.py` | `__version__ = "x.y.z"`(历史上常漏,1.1.0 时曾长期停在旧值) |

顺手检查:`src/facet/gateway/static/index.html` 里的控制台缓存版本号
(`?v=YYYYMMDD-NN`),改了 static 下任何文件就递增,否则浏览器用旧缓存。

```bash
grep -E '^version' pyproject.toml
grep -n "__version__" src/facet/__init__.py src/facet/gateway/__init__.py
```

## 第 2 步 · 发布说明 `docs/release-<版本>.md`

参照 `docs/release-1.1.3.md` 的结构:标题 → 一句话定位 → 分节写变更
(功能 / 修复 / 发布流水线)→ 「升级方法」表(Docker / Windows 安装包 /
macOS / pip / 源码五行,安装包名与镜像 tag 用新版本号)。
文件名必须精确匹配 `release-<版本>.md`——release.yml 用它当 Release notes,
不存在时 CI 会回退到自动生成(丢中文说明)。

pip 行的措辞:PyPI 上的日期版包 `2026.9.1` 在 PEP 440 排序里更高,裸装会
解析到旧版,升级表 pip 行务必写成锁版本:`pip install facet-models==x.y.z`。

## 第 3 步 · 全量回归

```bash
python -m pytest tests/ -q        # 基线:1502 passed + 192 subtests,约 4 分钟
```

零失败才继续。有失败先修,不带病发版。

## 第 4 步 · 提交并推送

```bash
git add pyproject.toml src/facet/__init__.py src/facet/gateway/__init__.py \
        docs/release-<版本>.md docs/PROGRESS.md
git commit   # 中文提交信息;PROGRESS.md「更新记录」表加一行
git push origin main
```

等 validate CI 绿:`gh run watch $(gh run list --workflow=validate.yml --limit 1 --json databaseId --jq '.[0].databaseId') --exit-status`

## 第 5 步 · verify 上报 + 触发发布

发版有两条触发路径,都要求中心后台先收到 verify 结果:

```bash
# 构建产物(本机)
python -m build --wheel --outdir dist
python tools/release/verify.py --center https://center.skillgo.cn \
    --token <CENTER_ADMIN_TOKEN> --skip-docker --skip-installer
```

verify 检查:版本三处一致、release-<v>.md 存在、全量测试、wheel 存在。
上报成功后,二选一:

- **中心后台**点「发版」→ `repository_dispatch(release_publish)` → release.yml
- **手动**:`gh workflow run release.yml -f version=<版本>`

release.yml 会自动做:Windows 安装包构建(windows runner)→ 账本渲染签名 →
wheel 构建 → 安装包 Ed25519 签名 → GitHub Release(notes 取
`docs/release-<版本>.md`,同 tag 重跑幂等 `--clobber`)→ **PyPI 上传**
(1.1.4 起新增;PYPI_API_TOKEN 未配置时跳过,同版本重传 400 幂等放行)。

观察:`gh run watch <run-id> --exit-status`(约 6 分钟)。

## 第 6 步 · Docker 镜像

```bash
gh workflow run publish-image.yml --ref main   # 或推 v<版本> tag 自动触发
gh run watch <run-id> --exit-status            # 约 2 分钟
```

产出 `hsliup/facet:<版本>` 与 `:latest` 双 tag。注意历史教训:
**tag 推送不总会触发 publish-image**(v1.1.3 就漏了),发完必须核对:

```bash
gh run list --workflow=publish-image.yml --limit 1
```

## 第 7 步 · 发布后验证(缺一不可)

```bash
# GitHub Release 产物齐全
gh api repos/hsliuping/Facet/releases/tags/v<版本> --jq '.assets[].name'
# 应含:Facet-Setup-<v>.exe、.exe.sig、facet_models-<v>-py3-none-any.whl、
#       intel.json(.sig)、registry.json(.sig)、intel.xml

# PyPI(1.1.4 起首次有真实数据)
python -c "import json,urllib.request;print(json.load(urllib.request.urlopen(
  'https://pypi.org/pypi/facet-models/json'))['info']['version'])"

# Docker Hub
curl -s -o /dev/null -w "%{http_code}\n" \
  https://hub.docker.com/v2/repositories/hsliup/facet/tags/<版本>
```

## 第 8 步 · 生产容器切换(118.89.187.218)

服务器直连 Docker Hub 极慢,加速器配置 `/etc/docker/daemon.json` 里
`docker.1ms.run` 可用但不快。**可靠路径是绕过 daemon 配置直接从加速节点拉**:

```bash
ssh ubuntu@118.89.187.218          # ~/.ssh/config 已配置
sudo docker pull docker.1panel.live/hsliup/facet:<版本>   # 加速节点直拉
sudo docker tag docker.1panel.live/hsliup/facet:<版本> hsliup/facet:<版本>
sudo docker run --rm --entrypoint python hsliup/facet:<版本> -c 'import facet; print(facet.__version__)'
# 备份 compose → 改 image: hsliup/facet:<版本> → 只重建 router(不 restart docker,
# 不波及同机 tradingagents / facet-center)
sudo cp /opt/facet/compose.yaml /opt/facet/compose.yaml.bak-<版本>
sudo sed -i "s|image: hsliup/facet:[0-9.]*|image: hsliup/facet:<版本>|" /opt/facet/compose.yaml
cd /opt/facet && sudo docker compose up -d router
# 验证:容器 healthy + 容器内 facet.__version__ + /health status ok
```

回滚:`cp compose.yaml.bak-<旧版> compose.yaml && docker compose up -d router`。

## 第 9 步 · 官网联动(D:\code\facet-website,独立 git 仓库)

```bash
cd D:/code/facet-website
grep -n "<旧版本>" index.html      # 三处:hero 徽章、安装包名+Docker 锁版本、pip 卡
# 逐处替换 → git commit → scp 上传(index.html + 受影响文件)到
# ubuntu@118.89.187.218:/var/www/aifacet.cn/ → chown www-data:www-data
curl -s https://www.aifacet.cn/ | grep -c "<新版本>"
```

pip 卡片规则:**PyPI 实测 `pip install facet-models==<版本>` 成功后才允许
pip 卡片出现在官网**(1.1.3 时因 PyPI 断档曾整个下架,第 7 步验证通过才能加回)。

## 第 10 步 · 收尾记录

- PROGRESS.md「更新记录」确认已含本版本行
- 官网 README.md 的「版本更新策略」段核对版本
- 向用户汇报:Release 链接、PyPI 版本、Docker tag、生产容器版本、官网版本

## 常见坑(历史真实发生)

| 坑 | 后果 | 防范 |
|---|---|---|
| `gateway/__init__.py` 版本漏改 | verify 不过 / 元数据混乱 | 第 1 步 grep 三处 |
| tag 推送没触发 publish-image | Docker Hub 停旧版,官网命令拉不到 | 第 6 步核对 run 列表 |
| PyPI 断档(1.1.x 缺失) | 官网 pip 命令必失败 | 第 7 步实测 pip 安装,通过前不上 pip 卡片 |
| wheel 上传了但 release notes 拿不到中文 | Release 页自动生成的英文 notes | 第 2 步确认 release-<v>.md 文件名精确 |
| 生产直连 Docker Hub 超时 | 拉取挂死 | 第 8 步走 docker.1panel.live 直拉 |
| 重启服务器 docker | 波及同机 tradingagents/facet-center | 永远只 `compose up -d router` |
| 本机 Docker Hub 拉取慢 | 半小时无进度 | 换国内加速器(daemon.json 三节点组)或 docker.1panel.live 直拉 |

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.