diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml new file mode 100644 index 0000000..561ab2f --- /dev/null +++ b/.github/workflows/build-package.yml @@ -0,0 +1,31 @@ +# create wheel file + +name: build Python package + +on: + push: + branches: [ master ] + +jobs: + build: + name: Build Wheel + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel + - name: Build package + run: | + python setup.py sdist bdist_wheel + - name: Upload Artifacts + uses: actions/upload-artifact@v2 + with: + path: | + dist/*.whl + dist/*.tar.gz diff --git a/.github/workflows/release-to-pypi.yml b/.github/workflows/release-to-pypi.yml new file mode 100644 index 0000000..0eb1fe7 --- /dev/null +++ b/.github/workflows/release-to-pypi.yml @@ -0,0 +1,36 @@ +# upload source and wheel from build action + +name: Upload Python Package + +on: + release: + types: [created] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build + run: | + python setup.py sdist bdist_wheel + - name: Upload Artifacts + uses: actions/upload-artifact@v2 + with: + path: | + dist/*.whl + dist/*.tar.gz + - name: Publish to PyPi + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + twine upload dist/* diff --git a/DEVELOPER.rst b/DEVELOPER.rst new file mode 100644 index 0000000..e08b1e5 --- /dev/null +++ b/DEVELOPER.rst @@ -0,0 +1,16 @@ +==================== +Notes for developers +==================== + +Creating a release +================== + +- Ensure that the ``version`` in ``serial_asyncio/__init__.py`` is updated + and in the form of major.minor[.patchlevel] +- Ensure all changes, including version, is committed then create a tag with + the exact same value as the version (e.g. "0.5") +- Push to GitHub, merge into master if it is a branch. The GitHub Actions + are set-up to build the default branch. +- Inspect the built wheel and tar.gz files for correctness, test. +- Trigger the upload to PyPi by using GitHub web interface "Releases" and + create a new release from the tag. diff --git a/LICENSE.txt b/LICENSE.txt index 89bde7a..ffc5453 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2015-2020 pySerial-team (see CREDITS.rst) +Copyright (c) 2015-2021 pySerial-team (see CREDITS.rst) All Rights Reserved. Redistribution and use in source and binary forms, with or without diff --git a/documentation/appendix.rst b/documentation/appendix.rst index 1551a03..0f178ab 100644 --- a/documentation/appendix.rst +++ b/documentation/appendix.rst @@ -4,7 +4,7 @@ License ======= -Copyright (c) 2015-2020 pySerial-team (see CREDITS.rst) +Copyright (c) 2015-2021 pySerial-team (see CREDITS.rst) All Rights Reserved. Redistribution and use in source and binary forms, with or without diff --git a/documentation/conf.py b/documentation/conf.py index e9fa4ec..e9ead6a 100644 --- a/documentation/conf.py +++ b/documentation/conf.py @@ -12,12 +12,30 @@ # serve to show the default. import sys, os +import pathlib +import re # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. #sys.path.append(os.path.abspath('.')) +def find_version(path: pathlib.Path): + """ + Search the file for a version string. + + file_path contain string path components. + + Reads the supplied Python module as text without importing it. + """ + version_file = path.read_text() + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", + version_file, re.M) + if version_match: + return version_match.group(1) + raise RuntimeError("Unable to find version string.") + + # -- General configuration ----------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be extensions @@ -41,16 +59,16 @@ # General information about the project. project = u'pySerial-asyncio' -copyright = u'2015-2020, pySerial-team' +copyright = u'2015-2021, pySerial-team' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = '0.5' +version = find_version(pathlib.Path(__file__).parent.parent / 'serial_asyncio' / '__init__.py') # The full version, including alpha/beta/rc tags. -release = '0.5' +release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages.