I was trying to push the package from the CI directly to pypi after successful build.
I have tried couple of tools, say "setuptools-scm", everything works well and i get automatic version change based on my tagging like package-0.0.2.post11-py3-none-any.whl in my local.
When i push the same code as part of github actions (command Run python3 setup.py sdist bdist_wheel) i dont see the versions getting updated and i always get package-0.0.0-py3-none-any.whl
Below is the snippet of setup.py
setuptools.setup(
name="package",
use_scm_version=True,
setup_requires=['setuptools_scm']
ymlfile:
publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install scm version
run: >-
python -m
pip install
setuptools-scm==4.1.2
- name: Install wheel
run: >-
python -m
pip install
wheel==0.34.2
- name: Build a binary wheel and a source tarball
run: >-
python3 setup.py sdist bdist_wheel
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.test_pypi_password }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}
pyproject.toml
# pyproject.toml
[build-system]
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
[tool.setuptools_scm]
write_to = "pkg/version.py"
I am not clear what i am doing wrong here, Can any one help to fix this ?
Thanks
on.push.tags?