-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: implement GitHub build process for pypi
Merge pull request #12 from d-Rickyy-b/dev
- Loading branch information
Showing
6 changed files
with
95 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# This workflows will upload a Python Package using Twine when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
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.7' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include LICENSE requirements.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = "1.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,63 @@ | ||
# -*- coding: utf-8 -*- | ||
import os | ||
from setuptools import setup, find_packages | ||
|
||
packages = find_packages() | ||
setup_path = os.path.dirname(os.path.abspath(__file__)) | ||
packages = find_packages(exclude=["tests*"]) | ||
|
||
setup(name='pyBrematic', | ||
version='1.0', | ||
keywords='python telegram bot api wrapper', | ||
description='Python code for controlling Brematic remote power outlets and potentially other stuff', | ||
url='https://github.com/d-Rickyy-b/pyBrematic', | ||
author='d-Rickyy-b', | ||
author_email='[email protected]', | ||
license='MIT', | ||
with open(os.path.join(setup_path, "README.md"), "r", encoding="utf-8") as file: | ||
readme = file.read() | ||
|
||
# Check if we are running on CI | ||
CI = os.environ.get("CI") | ||
if CI: | ||
version = "" | ||
TRAVIS_TAG = os.environ.get("TRAVIS_TAG") | ||
GITHUB_ACTIONS = os.environ.get("GITHUB_ACTIONS") | ||
|
||
if TRAVIS_TAG: | ||
print("Running on Travis!") | ||
version = TRAVIS_TAG.replace("v", "") | ||
elif GITHUB_ACTIONS: | ||
print("Running on GitHub Actions!") | ||
GITHUB_REF = os.environ.get("GITHUB_REF") | ||
tag = GITHUB_REF.split("/")[-1] | ||
version = tag.replace("v", "") | ||
else: | ||
# Taken from https://packaging.python.org/guides/single-sourcing-package-version/ | ||
version_dict = {} | ||
version_file = os.path.join(setup_path, "pyBrematic", "version.py") | ||
with open(version_file, "r", encoding="utf-8") as file: | ||
exec(file.read(), version_dict) | ||
version = version_dict["__version__"] | ||
|
||
print("Building version '{0}' of pyBrematic".format(version)) | ||
|
||
setup(name="pyBrematic", | ||
version=version, | ||
keywords="python telegram bot api wrapper", | ||
description="Python code for controlling Brematic remote power outlets and potentially other stuff", | ||
long_description=readme, | ||
long_description_content_type="text/markdown", | ||
url="https://github.com/d-Rickyy-b/pyBrematic", | ||
author="d-Rickyy-b", | ||
author_email="[email protected]", | ||
license="MIT", | ||
packages=packages, | ||
zip_safe=False) | ||
include_package_data=True, | ||
zip_safe=False, | ||
classifiers=[ | ||
"Development Status :: 5 - Production/Stable", | ||
"Environment :: Console", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Science/Research", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
"Topic :: Software Development :: Libraries :: Python Modules", | ||
"Topic :: Internet", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3.5", | ||
"Programming Language :: Python :: 3.6", | ||
"Programming Language :: Python :: 3.7", | ||
], | ||
) |