From 1f68ca0878f9866957b3b407fab1b0e31080c891 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 29 Aug 2021 18:36:51 -0700 Subject: [PATCH] pypi publish & github actions (#2) * setup has long description * wip * add github actions --- .github/workflows/main.yml | 44 ++++++++++++++++++++++++++++++++++++++ ivi_sdk/__init__.py | 0 setup.py | 8 +++++++ 3 files changed, 52 insertions(+) create mode 100644 .github/workflows/main.yml create mode 100644 ivi_sdk/__init__.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..ab89228 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,44 @@ +name: main deployment to pypi +on: + workflow_dispatch: + push: + branches: [develop] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: pip install kfp + run: | + pip install --upgrade build + pip install --upgrade twine + + - name: build files + run: | + python -m build + + - name: push to pypi + run: | + python -m twine upload dist/* -u "__token__" -p ${{ secrets.PYPI_SECRET }} + + - name: Slack Notification + uses: 8398a7/action-slack@v3 + if: always() + with: + status: custom + fields: workflow,job,commit,repo,ref,author,took,message + custom_payload: | + { + username: 'github-actions', + icon_emoji: ':octocat:', + attachments: [{ + color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning', + text: `${process.env.AS_WORKFLOW}\n${process.env.AS_JOB} (${process.env.AS_COMMIT}) of ${process.env.AS_REPO} by ${process.env.AS_AUTHOR} finished in ${process.env.AS_TOOK}\nMessage: ${process.env.AS_MESSAGE}`, + }] + } + env: + GITHUB_TOKEN: ${{ github.token }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} diff --git a/ivi_sdk/__init__.py b/ivi_sdk/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/setup.py b/setup.py index a6be803..543546b 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,9 @@ from setuptools import setup from setuptools.command.build_py import build_py import subprocess +import os +cwd = os.path.dirname(os.path.abspath(__file__)) class ivi_build_py(build_py): def run(self): @@ -46,13 +48,19 @@ def find_package_modules(self, package, package_dir): base_requires = ['grpcio==1.34.0', 'protobuf<4.0dev,>=3.5.0.post1'] +with open(os.path.join(cwd, "README.md"), encoding="utf-8") as f: + long_description = f.read() + setup( name='ivi_sdk', version='0.1', description='Simple IVI gRPC stream API wrapper', + long_description=long_description, + long_description_content_type="text/markdown", packages=[''], package_dir={'': 'ivi_sdk'}, install_requires=base_requires, setup_requires=base_requires + ['grpcio-tools==1.34.0'], test_requires=base_requires + ['pytest', 'pytest-asyncio'], + python_requires='>=3.6', cmdclass={'build_py': ivi_build_py})