From 74efc6e216939659b4ec40c53e03304341d2f5d8 Mon Sep 17 00:00:00 2001 From: Yu Zheng Date: Sun, 12 Apr 2026 13:22:23 -0400 Subject: [PATCH 1/2] ci: auto-publish CLI to PyPI on GitHub release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Uses PyPI trusted publishing (OIDC) — no stored tokens needed. Triggered when a GitHub Release is published. Verifies the tag matches the version in pyproject.toml before uploading. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/publish.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) 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..a546eb8 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,37 @@ +name: Publish to PyPI + +on: + release: + types: [published] + +jobs: + build-and-publish: + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write # required for PyPI trusted publishing (OIDC) + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install build tooling + run: python -m pip install --upgrade build + + - name: Build sdist and wheel + run: python -m build + + - name: Verify version matches release tag + run: | + TAG="${GITHUB_REF_NAME#v}" + PKG_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])") + if [ "$TAG" != "$PKG_VERSION" ]; then + echo "Release tag ($TAG) does not match pyproject.toml version ($PKG_VERSION)" >&2 + exit 1 + fi + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 From c8a80c261b66165935f71cfb94401884af5af57c Mon Sep 17 00:00:00 2001 From: "openai-code-agent[bot]" <242516109+Codex@users.noreply.github.com> Date: Sun, 12 Apr 2026 17:28:44 +0000 Subject: [PATCH 2/2] fix: add contents permission for publish workflow Co-authored-by: DavyMorgan <27959377+DavyMorgan@users.noreply.github.com> --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a546eb8..8d3ea9a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,6 +9,7 @@ jobs: runs-on: ubuntu-latest environment: pypi permissions: + contents: read # required for actions/checkout id-token: write # required for PyPI trusted publishing (OIDC) steps: