diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..97ac119 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +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/* + - 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/ 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]