diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index c52a302e7..3056cdd1d 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -2,6 +2,8 @@ # Python package to PiPy. This makes use of Twine and is triggered when a push # to the main branch occures. For more information see: # https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries +# and for details on the Autobump version section see: +# https://github.com/grst/python-ci-versioneer name: Upload Python Package @@ -20,10 +22,24 @@ jobs: uses: actions/setup-python@v2 with: python-version: '3.x' + + - name: Autobump version + run: | + # from refs/tags/v1.2.3 get 1.2.3 + VERSION=$(echo $GITHUB_REF | sed 's#.*/v##') + PLACEHOLDER='version="develop"' + VERSION_FILE='setup.py' + # Grep checks that the placeholder is in the file. If grep doesn't find + # the placeholder then it exits with exit code 1 and github actions fails. + grep "$PLACEHOLDER" "$VERSION_FILE" + sed -i "s/$PLACEHOLDER/version=\"${VERSION}\"/g" "$VERSION_FILE" + shell: bash + - name: Install dependencies run: | python -m pip install --upgrade pip pip install setuptools wheel twine + - name: Build and publish env: TWINE_USERNAME: __token__ diff --git a/setup.py b/setup.py index a6890b0b0..9057146d1 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="paramak", - version="0.2.8", + version="develop", author="The Paramak Development Team", author_email="mail@jshimwell.com", description="Create 3D fusion reactor CAD models based on input parameters",