diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml new file mode 100644 index 00000000..21f37f59 --- /dev/null +++ b/.github/workflows/publish_pypi.yml @@ -0,0 +1,64 @@ +name: Build and publish package to PyPI + +on: + workflow_dispatch: + inputs: + target: + description: 'Deployment target. Can be "pypi" or "testpypi"' + default: 'pypi' + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.8] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: pip install wheel + + - name: Build package + run: python setup.py sdist --formats=gztar bdist_wheel + + - name: Upload package + uses: actions/upload-artifact@v2 + with: + name: files + path: ./dist/ + if-no-files-found: error + + + publish: + needs: build + runs-on: ubuntu-latest + steps: + - name: Download package + uses: actions/download-artifact@v2 + with: + name: files + path: dist + + - name: Publish on PyPI + if: github.event.inputs.target == 'pypi' + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} + packages_dir: dist/ + + - name: Publish on TestPyPI + if: github.event.inputs.target == 'testpypi' + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.TESTPYPI_TOKEN }} + packages_dir: dist/ + repository_url: https://test.pypi.org/legacy/ diff --git a/liionpack/__init__.py b/liionpack/__init__.py index 68ae6a38..7fc22fc9 100644 --- a/liionpack/__init__.py +++ b/liionpack/__init__.py @@ -39,4 +39,4 @@ from .solvers import generic_actor from .solvers import ray_actor -__version__ = "0.2.1" +__version__ = "0.3" diff --git a/setup.py b/setup.py index 4c7ae9cb..fd66ab09 100644 --- a/setup.py +++ b/setup.py @@ -9,6 +9,7 @@ except ImportError: from distutils.core import setup +# Load version main_ = {} ver_path = convert_path("liionpack/__init__.py") with open(ver_path) as f: @@ -16,10 +17,16 @@ if line.startswith("__version__"): exec(line, main_) +# Load readme for description +with open("README.md", encoding="utf-8") as f: + readme = f.read() + setup( name="liionpack", description="A battery pack simulator for PyBaMM", version=main_["__version__"], + long_description=readme, + long_description_content_type="text/markdown", classifiers=[ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License",