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
+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