From 1ca62d4635ece1f5c51831b5fc4f2dbdc2ad8965 Mon Sep 17 00:00:00 2001 From: jackwener Date: Thu, 5 Mar 2026 16:16:00 +0800 Subject: [PATCH] chore: add pypi publish workflow and uv-first install docs --- .github/workflows/publish.yml | 34 ++++++++++++++++++++++++++++++++++ README.md | 22 ++++++++++++++++++---- pyproject.toml | 5 ++++- 3 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..2781333 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,34 @@ +name: Publish to PyPI + +on: + push: + tags: + - "v*" + workflow_dispatch: + +jobs: + verify: + uses: ./.github/workflows/ci.yml + + publish: + needs: verify + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Setup uv + uses: astral-sh/setup-uv@v6 + + - name: Build package + run: uv build + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/README.md b/README.md index ae87c60..23fd365 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,27 @@ Twitter/X 命令行工具 — 读取 Timeline、书签和用户信息。 **零 API Key** — 使用浏览器 Cookie 认证,免费访问 Twitter。 +## 安装 + +```bash +# 推荐:uv tool(更快,隔离环境) +uv tool install twitter-cli + +# 其次:pipx +pipx install twitter-cli +``` + +从源码安装: + +```bash +git clone git@github.com:jackwener/twitter-cli.git +cd twitter-cli +uv sync +``` + ## Quick Start ```bash -# 安装 -cd twitter-cli -uv sync - # 运行(自动从 Chrome 提取 Cookie) twitter feed ``` diff --git a/pyproject.toml b/pyproject.toml index c809199..6cf0315 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "twitter-cli" version = "0.1.0" -description = "A CLI for Twitter/X — feed, bookmarks, tweet, filtering" +description = "A CLI for Twitter/X — feed, bookmarks, and user timeline in terminal" readme = "README.md" license = "Apache-2.0" requires-python = ">=3.8" @@ -52,3 +52,6 @@ python_files = ["test_*.py"] [tool.ruff] line-length = 100 + +[tool.hatch.build.targets.wheel] +packages = ["twitter_cli"]