diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml new file mode 100644 index 00000000..4a613a10 --- /dev/null +++ b/.github/workflows/publish-to-pypi.yml @@ -0,0 +1,53 @@ +name: Build and Publish to PyPI + +on: + workflow_dispatch: + release: + types: [published] + +jobs: + build-and-publish: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write # Required for trusted publishing to PyPI + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Build frontend + run: | + cd web + npm install + npm run build + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + pip install build twine + + - name: Build package + run: | + python -m build + + - name: Check package + run: | + twine check dist/* + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + skip-existing: true diff --git a/.gitignore b/.gitignore index ecfb7207..07d7eb9a 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,8 @@ uv.lock plugins.bak coverage.xml .coverage + +# Build artifacts +/dist +/build +*.egg-info diff --git a/pyproject.toml b/pyproject.toml index d7b3d854..9f6d425c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,6 +3,7 @@ name = "langbot" version = "4.4.1" description = "Easy-to-use global IM bot platform designed for LLM era" readme = "README.md" +license = {text = "AGPL-3.0-or-later"} requires-python = ">=3.10.1,<4.0" dependencies = [ "aiocqhttp>=1.4.4",