Skip to content

Commit

Permalink
Merge pull request #75 from pyserial/feat-github-actions
Browse files Browse the repository at this point in the history
chore(CI): add github actions for easier releasing
  • Loading branch information
zsquareplusc authored Sep 30, 2021
2 parents 6738f89 + a61cccb commit 07fe4de
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 5 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build-package.yml
Original file line number Diff line number Diff line change
@@ -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
36 changes: 36 additions & 0 deletions .github/workflows/release-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -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/*
16 changes: 16 additions & 0 deletions DEVELOPER.rst
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion documentation/appendix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 21 additions & 3 deletions documentation/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down

0 comments on commit 07fe4de

Please sign in to comment.