diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100755 index 0000000..cac7595 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,32 @@ +name: Release and Publish Python Package + +on: + push: + tags: + - "v*" + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Install dependencies + run: | + python -m pip install --upgrade pip build + - name: Build package + run: | + python3 -m build --sdist --wheel --outdir dist/ . + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 + - name: Create GitHub release + uses: softprops/action-gh-release@v2 + with: + files: | + dist/* diff --git a/README.md b/README.md index edc1093..1ab263c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # python-package-template -A template for Python project to be published on PyPI with setuptools, python-build, PyPI trusted publisher and github actions auto release. + +A template for Python project to be published on PyPI with setuptools, python-build, PyPI trusted publishing and github actions auto release. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e8fb747 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,19 @@ +[project] +# name = "Project name..." +# version = "Project version, e.g. 0.0.1" +# description = "Project description..." +# authors = [ +# {name = "Author name", email = "Author email"}, +# ... +# ] +# license = {text = "Project license on PyPI, e.g. MIT"} +# dependencies = ["dependency1...", "dependency2...", ...] +# requires-python = ">=3.9" +readme = "README.md" + +[project.urls] +# Homepage = "https://github.com/..." +# Repository = "https://github.com/..." + +[tool.pyright] +pythonVersion = "3.9"