From f237a7dd96a7c5fed0c1c63b76e3adf46d03f969 Mon Sep 17 00:00:00 2001 From: Chris Liechti Date: Thu, 30 Sep 2021 21:46:28 +0200 Subject: [PATCH 1/4] chore(CI): add github actions for easier releasing --- .github/workflows/build-package.yml | 31 +++++++++++++++++++++++ .github/workflows/release-to-pypi.yml | 36 +++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 .github/workflows/build-package.yml create mode 100644 .github/workflows/release-to-pypi.yml 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/* From f2ab7b24553abd6751770b1d24e5959405805357 Mon Sep 17 00:00:00 2001 From: Chris Liechti Date: Thu, 30 Sep 2021 22:03:53 +0200 Subject: [PATCH 2/4] chore(documentation): read version automatically from __init__.py --- documentation/conf.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/documentation/conf.py b/documentation/conf.py index e9fa4ec..cf3117c 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 @@ -48,9 +66,9 @@ # 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. From 0fbea23c7b445e6bbb7491511b3064fd5793ca0a Mon Sep 17 00:00:00 2001 From: Chris Liechti Date: Thu, 30 Sep 2021 22:06:18 +0200 Subject: [PATCH 3/4] docs: update (C) date --- LICENSE.txt | 2 +- documentation/appendix.rst | 2 +- documentation/conf.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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 cf3117c..e9ead6a 100644 --- a/documentation/conf.py +++ b/documentation/conf.py @@ -59,7 +59,7 @@ def find_version(path: pathlib.Path): # 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 From a61cccb7779a99f59de00897b68f7635bb3d8ad1 Mon Sep 17 00:00:00 2001 From: Chris Liechti Date: Thu, 30 Sep 2021 22:24:11 +0200 Subject: [PATCH 4/4] docs: add developer nots with release procedure --- DEVELOPER.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 DEVELOPER.rst 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.