From f87c873d7250b64fa1426b667c0e8588c4d53150 Mon Sep 17 00:00:00 2001 From: James Brown Date: Fri, 13 Mar 2026 16:54:49 -0700 Subject: [PATCH] gha: add release workflow using trusted publishing --- .github/workflows/release.yml | 30 ++++++++++++++++++++++++++++++ tests/smoke_test.py | 11 +++++++++++ 2 files changed, 41 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 tests/smoke_test.py diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..86c00c0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: Release +on: + push: + tags: + - v* +jobs: + pypi: + name: Publish to PyPI + runs-on: ubuntu-latest + environment: + name: release + permissions: + id-token: write + contents: read + steps: + - name: Checkout + uses: actions/checkout@v5 + - name: Install uv + uses: astral-sh/setup-uv@v7 + - name: Install Python 3.13 + run: uv python install 3.13 + - name: Build + run: uv build + # Check that basic features work and we didn't miss to include crucial files + - name: Smoke test (wheel) + run: uv run --isolated --no-project --with dist/*.whl tests/smoke_test.py + - name: Smoke test (source distribution) + run: uv run --isolated --no-project --with dist/*.tar.gz tests/smoke_test.py + - name: Publish + run: uv publish diff --git a/tests/smoke_test.py b/tests/smoke_test.py new file mode 100644 index 0000000..b65527c --- /dev/null +++ b/tests/smoke_test.py @@ -0,0 +1,11 @@ +import ksuid + +basic = ksuid.Ksuid() +parsed = ksuid.Ksuid.from_base62(str(basic)) +assert parsed.timestamp == basic.timestamp + +ms = ksuid.Ksuid() +parsed = ksuid.Ksuid.from_base62(str(ms)) +assert parsed.timestamp == basic.timestamp + +print("Ok")