π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
[Feat] Automate pypi release in github actions (#915)
Edgar Ribad2dc0908f030
diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.ymlnew file mode 100644index 000000000..669d8df7e--- /dev/null+++ b/.github/workflows/pypi-release.yml@@ -0,0 +1,35 @@+name: PyPI Release++# https://help.github.com/en/actions/reference/events-that-trigger-workflows+on: # Trigger the workflow on push or pull request, but only for the master branch+ push:+ branches: [master]+ release:+ types: [published]+++jobs:+ # based on https://github.com/pypa/gh-action-pypi-publish+ build-publish:+ runs-on: ubuntu-20.04++ steps:+ - uses: actions/checkout@v2+ - uses: actions/setup-python@v2+ with:+ python-version: 3.7++ - name: Install dependencies+ run: >-+ python -m pip install --user --upgrade setuptools wheel+ - name: Build+ run: |+ KORNIA_RELEASE=1 python setup.py sdist bdist_wheel+ ls -lh dist/++ - name: Publish distribution π¦ to PyPI+ if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release'+ uses: pypa/gh-action-pypi-publish@master+ with:+ user: __token__+ password: ${{ secrets.pypi_password }}diff --git a/setup.py b/setup.pyindex b98306a4f..6e17bec9f 100644--- a/setup.py+++ b/setup.py@@ -16,7 +16,7 @@ import distutils.command.clean# NOTE(maintainers): modify this variable each time you do a release-version = '0.4.2' # this a tag for the current development version+version = '0.5.0' # this a tag for the current development version# NOTE(maintainers): update this dictionary each time you do a release@@ -25,6 +25,7 @@ version = '0.4.2' # this a tag for the current development version# Once a pytorch version (in the future) breaks a kornia version, we could just# add a maximal version.kornia_pt_dependencies = {+ '0.5.0': '>=1.6.0','0.4.2': '>=1.5.1','0.4.1': '>=1.6.0','0.4.0': '>=1.6.0,<1.7.0',@@ -56,6 +57,8 @@ except Exception:if os.getenv('KORNIA_BUILD_VERSION'):version = os.getenv('KORNIA_BUILD_VERSION')+elif os.getenv('KORNIA_RELEASE'):+ passelif sha != 'Unknown':version += '+' + sha[:7]print("Building wheel {}-{}".format(package_name, version))