add # 新增Nonebot发布工作流

This commit is contained in:
2026-10-21 18:35:16 +08:00
parent c7d97e294a
commit 531409b8b6
26 changed files with 1585 additions and 19 deletions
+11 -7
View File
@@ -1,11 +1,15 @@
# 发布设计预留位置
# 发布生成配置
targets.json 只记录用户提供的仓库与目标名称;enabled=false。
没有可执行同步脚本、Actions、远程写凭据或发布授权。
主仓库是唯一业务开发源。真寻与 NoneBot 已有离线打包、清单验证和
固定目标同步脚本;AstrBot 仍为设计预留,未启用。
主仓库构建的每个产物只含同版本核心、当前框架接入、所需资源和依赖。
首次接管三个现有仓库需先比较已有内容,通过候选 PR 审查,
不得直接清空目标仓库或强推。
真寻使用插件目录布局,NoneBot 使用标准 Python 包布局。
同步脚本默认 dry-run;带 `--publish` 才使用 `FARM_RELEASE_TOKEN`
向固定仓库 `main` 普通提交完整生成树,保留历史并检查分支并发变更。
生成树会替换目标分支的当前文件集合,首次同步前应审查输出内容。
用户已要求停止拉取并删除本地克隆,当前不得重新检出这些仓库。
完整规则见 docs/04-release-design.md。
NoneBot 既有 `publish.yaml` 已从远端读取,生成模板继续使用 `v*`
标签触发及 `PYPI_TOKEN`。主仓库的同步任务沿用真寻 environment
`zhenxun-preview` 和 `FARM_RELEASE_TOKEN`,普通同步不会发布 PyPI。
本次没有执行远端推送、分支同步或 PyPI 发布。
+3
View File
@@ -0,0 +1,3 @@
include version.txt LICENSE README.md FARM-MANIFEST.json verify_package.py
include images/farm-preview.png
recursive-include nonebot_plugin_farm *.py *.json *.zip *.md
+53
View File
@@ -0,0 +1,53 @@
name: 🚀 发布到 PyPI
on:
push:
tags: ['v*']
permissions:
contents: read
concurrency:
group: nonebot-pypi-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-python@v7
with:
python-version: '3.10'
- name: Verify generated files
run: python verify_package.py --directory .
- name: Check tag matches package version
env:
RELEASE_TAG: ${{ github.ref_name }}
run: |
python - <<'PY'
import os
from pathlib import Path
version = Path('version.txt').read_text().strip()
if os.environ['RELEASE_TAG'] != 'v' + version:
raise SystemExit('Tag differs from version.txt')
PY
- run: python -m pip install build twine
- run: python -m build --sdist --wheel --outdir ../packages
- run: python -m twine check ../packages/*
- uses: actions/upload-artifact@v7
with:
name: pypi-distributions
path: ../packages/*
if-no-files-found: error
publish:
needs: build
if: github.repository == 'Shu-Ying/nonebot_plugin_farm'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v8
with:
name: pypi-distributions
path: dist
- name: 📤 发布到 PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
+35
View File
@@ -0,0 +1,35 @@
[build-system]
requires = ["setuptools>=68", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "nonebot_plugin_farm"
dynamic = ["version"]
description = "快乐的农场时光"
readme = "README.md"
requires-python = ">=3.10"
license = {text = "GPL-3.0-or-later"}
authors = [{name = "Art_Sakura"}, {name = "Shu-Ying"}]
dependencies = [
"nonebot2>=2.4,<3",
"nonebot-plugin-alconna>=0.60,<1",
"nonebot-plugin-uninfo>=0.6,<1",
"nonebot-plugin-localstore>=0.7,<1",
"Pillow>=10.4,<13",
]
[project.urls]
Repository = "https://github.com/Shu-Ying/nonebot_plugin_farm"
[tool.setuptools.dynamic]
version = {file = "version.txt"}
[tool.setuptools.packages.find]
where = ["."]
include = ["nonebot_plugin_farm*"]
[tool.setuptools.package-data]
"nonebot_plugin_farm._vendor.farm_core" = ["data/*.json"]
"nonebot_plugin_farm._vendor.farm_render" = [
"data/*.json", "data/*.zip", "data/*.md",
]
+26
View File
@@ -0,0 +1,26 @@
name: Verify generated NoneBot farm
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
persist-credentials: false
- uses: actions/setup-python@v7
with:
python-version: '3.10'
- run: python verify_package.py --directory .
- run: python -m pip install build
- run: python -m build --sdist --wheel --outdir ../packages
- uses: actions/upload-artifact@v7
with:
name: nonebot-distributions
path: ../packages/*
if-no-files-found: error
+4 -2
View File
@@ -1,6 +1,6 @@
{
"schema": "farm.release-targets.v1",
"status": "zhenxun-preview",
"status": "zhenxun-and-nonebot-preview",
"source_repository": "https://github.com/Shu-Ying/main_plugin_farm.git",
"network_actions_enabled": false,
"targets": [
@@ -25,7 +25,9 @@
"repository": "https://github.com/Shu-Ying/nonebot_plugin_farm.git",
"observed_default_branch": "main",
"entry_directory": "integrations/nonebot",
"enabled": false
"enabled": true,
"preview_branch": "main",
"publish_by_default": false
}
]
}