Skip to content

Commit 07fe4de

Browse files
authored
Merge pull request #75 from pyserial/feat-github-actions
chore(CI): add github actions for easier releasing
2 parents 6738f89 + a61cccb commit 07fe4de

File tree

6 files changed

+106
-5
lines changed

6 files changed

+106
-5
lines changed

.github/workflows/build-package.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# create wheel file
2+
3+
name: build Python package
4+
5+
on:
6+
push:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
name: Build Wheel
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up Python
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: '3.x'
19+
- name: Install build dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install setuptools wheel
23+
- name: Build package
24+
run: |
25+
python setup.py sdist bdist_wheel
26+
- name: Upload Artifacts
27+
uses: actions/upload-artifact@v2
28+
with:
29+
path: |
30+
dist/*.whl
31+
dist/*.tar.gz

.github/workflows/release-to-pypi.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# upload source and wheel from build action
2+
3+
name: Upload Python Package
4+
5+
on:
6+
release:
7+
types: [created]
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up Python
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: '3.x'
18+
- name: Install dependencies
19+
run: |
20+
python -m pip install --upgrade pip
21+
pip install setuptools wheel twine
22+
- name: Build
23+
run: |
24+
python setup.py sdist bdist_wheel
25+
- name: Upload Artifacts
26+
uses: actions/upload-artifact@v2
27+
with:
28+
path: |
29+
dist/*.whl
30+
dist/*.tar.gz
31+
- name: Publish to PyPi
32+
env:
33+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
34+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
35+
run: |
36+
twine upload dist/*

DEVELOPER.rst

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
====================
2+
Notes for developers
3+
====================
4+
5+
Creating a release
6+
==================
7+
8+
- Ensure that the ``version`` in ``serial_asyncio/__init__.py`` is updated
9+
and in the form of major.minor[.patchlevel]
10+
- Ensure all changes, including version, is committed then create a tag with
11+
the exact same value as the version (e.g. "0.5")
12+
- Push to GitHub, merge into master if it is a branch. The GitHub Actions
13+
are set-up to build the default branch.
14+
- Inspect the built wheel and tar.gz files for correctness, test.
15+
- Trigger the upload to PyPi by using GitHub web interface "Releases" and
16+
create a new release from the tag.

LICENSE.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2015-2020 pySerial-team (see CREDITS.rst)
1+
Copyright (c) 2015-2021 pySerial-team (see CREDITS.rst)
22
All Rights Reserved.
33

44
Redistribution and use in source and binary forms, with or without

documentation/appendix.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
License
66
=======
7-
Copyright (c) 2015-2020 pySerial-team (see CREDITS.rst)
7+
Copyright (c) 2015-2021 pySerial-team (see CREDITS.rst)
88
All Rights Reserved.
99

1010
Redistribution and use in source and binary forms, with or without

documentation/conf.py

+21-3
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,30 @@
1212
# serve to show the default.
1313

1414
import sys, os
15+
import pathlib
16+
import re
1517

1618
# If extensions (or modules to document with autodoc) are in another directory,
1719
# add these directories to sys.path here. If the directory is relative to the
1820
# documentation root, use os.path.abspath to make it absolute, like shown here.
1921
#sys.path.append(os.path.abspath('.'))
2022

23+
def find_version(path: pathlib.Path):
24+
"""
25+
Search the file for a version string.
26+
27+
file_path contain string path components.
28+
29+
Reads the supplied Python module as text without importing it.
30+
"""
31+
version_file = path.read_text()
32+
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
33+
version_file, re.M)
34+
if version_match:
35+
return version_match.group(1)
36+
raise RuntimeError("Unable to find version string.")
37+
38+
2139
# -- General configuration -----------------------------------------------------
2240

2341
# Add any Sphinx extension module names here, as strings. They can be extensions
@@ -41,16 +59,16 @@
4159

4260
# General information about the project.
4361
project = u'pySerial-asyncio'
44-
copyright = u'2015-2020, pySerial-team'
62+
copyright = u'2015-2021, pySerial-team'
4563

4664
# The version info for the project you're documenting, acts as replacement for
4765
# |version| and |release|, also used in various other places throughout the
4866
# built documents.
4967
#
5068
# The short X.Y version.
51-
version = '0.5'
69+
version = find_version(pathlib.Path(__file__).parent.parent / 'serial_asyncio' / '__init__.py')
5270
# The full version, including alpha/beta/rc tags.
53-
release = '0.5'
71+
release = version
5472

5573
# The language for content autogenerated by Sphinx. Refer to documentation
5674
# for a list of supported languages.

0 commit comments

Comments
 (0)