diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index a056a17..9c5d4e9 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -1,4 +1,4 @@ -name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI +name: Publish Python 🐍 distributions 📦 to PyPI on: release: @@ -6,7 +6,7 @@ on: jobs: build-n-publish: - name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI + name: Build and publish Python 🐍 distributions 📦 to PyPI runs-on: ubuntu-18.04 steps: @@ -16,6 +16,18 @@ jobs: with: python-version: 3.7 + - 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='src/securityscorecard_api/version2.py' + # ensure the placeholder is there. If grep doesn't find the placeholder + # it exits with exit code 1 and github actions aborts the build. + grep "$PLACEHOLDER" "$VERSION_FILE" + sed -i "s/$PLACEHOLDER/__version__ = \"${VERSION}\"/g" "$VERSION_FILE" + shell: bash + - name: Install pypa/build run: >- python -m diff --git a/setup.py b/setup.py index d2ece2d..a50a999 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ with open("README.md", "r") as fh: long_description = fh.read() -exec(open('src/securityscorecard_api/version.py').read()) +exec(open('src/securityscorecard_api/version2.py').read()) setup( name="securityscorecard_api", diff --git a/src/securityscorecard_api/version2.py b/src/securityscorecard_api/version2.py new file mode 100644 index 0000000..2deb12f --- /dev/null +++ b/src/securityscorecard_api/version2.py @@ -0,0 +1 @@ +__version__ = "develop" \ No newline at end of file