Skip to content

Commit

Permalink
Use setuptools-git-versioning (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
puddly committed Apr 24, 2023
1 parent 646b07a commit 58f2053
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Set package version
- name: Build wheel
run: |
version="${{ github.event.release.tag_name }}"
version="${version,,}" # lowercase it
version="${version#v}" # remove `v`
sed -i "s/version = \"0\.0\.0\"/version = \"${version}\"/" pyproject.toml
- name: Install wheel
run: >-
VERSION="${{ github.event.release.tag_name }}"
VERSION="${VERSION,,}" # lowercase it
VERSION="${VERSION#v}" # remove `v`
pip install wheel build
- name: Build
run: >-
python3 -m build
# Fail if we don't generate a package with the expected version
if ( ! ls -A "dist/*${VERSION}*.whl" 1> /dev/null 2>&1 ); then
exit 1
fi
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[build-system]
requires = ["setuptools>=61.0.0"]
requires = ["setuptools>=61.0.0", "wheel", "setuptools-git-versioning<2"]
build-backend = "setuptools.build_meta"

[project]
name = "zigpy-znp"
version = "0.0.0"
dynamic = ["version"]
description = "A library for zigpy which communicates with TI ZNP radios"
urls = {repository = "https://github.com/zigpy/zigpy-znp"}
authors = [
Expand Down Expand Up @@ -34,6 +34,9 @@ testing = [
"coveralls",
]

[tool.setuptools-git-versioning]
enabled = true


[tool.black]
safe = true
Expand Down

0 comments on commit 58f2053

Please sign in to comment.