diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..3762f73 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,42 @@ +name: Release + +on: + push: + branches: + - master + +jobs: + release-on-push: + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - id: release + uses: rymndhng/release-on-push-action@v0.20.0 + with: + bump_version_scheme: patch + + pypi-deploy: + runs-on: ubuntu-latest + # run only on successful release + needs: release-on-push + steps: + - name: Checkout + uses: actions/checkout@v2.3.4 + - name: Set up python + uses: actions/setup-python@v2.2.2 + with: + python-version: 3.8 + architecture: x64 + - name: Build + env: + VERSION: ${{ needs.release-on-push.release.outputs.version }} + run: | + pip install wheel + echo "__version__ = '$VERSION'" >> frbcat/__version__.py + python setup.py sdist bdist_wheel + - name: Deploy + uses: pypa/gh-action-pypi-publish@v1.4.2 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} diff --git a/frbcat/__init__.py b/frbcat/__init__.py index 722634d..c1a3818 100644 --- a/frbcat/__init__.py +++ b/frbcat/__init__.py @@ -2,3 +2,4 @@ from .frbcat_file import Frbcat from .chime_repeaters import ChimeRepeaters from .tns import TNS +from .__version__ import __version__ diff --git a/frbcat/__version__.py b/frbcat/__version__.py new file mode 100644 index 0000000..13df827 --- /dev/null +++ b/frbcat/__version__.py @@ -0,0 +1 @@ +version = 'github' diff --git a/setup.py b/setup.py index 4750857..6eeba65 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,15 @@ """Installation setup of the frbcat python package.""" +import os from setuptools import setup +with open(os.path.join('frbcat', '__version__.py')) as f: + version = {} + exec(f.read(), version) + project_version = version['__version__'] + + setup(name='frbcat', - version='0.2.16', + version=project_version, description='Query the FRB catalogue', url='http://github.com/davidgardenier/frbcat', author='David Gardenier',