From 8dd7e30d5c424e3801ba161d80fb97270aba2b7c Mon Sep 17 00:00:00 2001 From: Elephant Liu Date: Fri, 11 Jul 2025 14:45:42 +0800 Subject: [PATCH 1/2] chore: auto release by github action --- .github/workflows/release.yml | 26 ++++++++++++++++++++++++++ pyproject.toml | 7 +++++-- 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..e21362d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,26 @@ +name: release + +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + # include git history for setuptools-scm + fetch-depth: 20 + fetch-tags: true + - name: Set up Python + uses: actions/setup-python@v3 + - name: build + run: | + python -m pip install build + python -m build + - name: dump result + run: | + ls -alh dist/ + - uses: actions/upload-artifact@v4 + with: + name: dist + path: ./dist/* diff --git a/pyproject.toml b/pyproject.toml index 8b5afd7..5b25692 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,5 @@ [project] name = "smart_pinyin" -version = "0.4.6" description = "Smart Chinese-to-Pinyin converter." authors = [ @@ -22,9 +21,13 @@ dependencies = [ readme = "README.md" +dynamic = ["version"] + [project.urls] Homepage = "https://github.com/xospc/python-smart-pinyin" [build-system] -requires = ["setuptools"] +requires = ["setuptools>=64", "setuptools-scm>=8"] build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] From 4b0b4d73d473edce6ec470bc7305335609cf5fe8 Mon Sep 17 00:00:00 2001 From: Elephant Liu Date: Fri, 11 Jul 2025 17:35:12 +0800 Subject: [PATCH 2/2] publish to test pypi --- .github/workflows/release.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e21362d..97ac119 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,3 +24,12 @@ jobs: with: name: dist path: ./dist/* + - name: Publish to PyPI + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: dist/ + skip-existing: true + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository-url: https://test.pypi.org/legacy/