From bfb89cb5272b95007168369224963692c9d8b91a Mon Sep 17 00:00:00 2001 From: Deva Kodali Date: Tue, 17 Nov 2020 15:24:24 -0600 Subject: [PATCH] Add functionality to upload python package to Pypi (#1) --- .github/workflows/python-publish.yml | 43 ++++++++++++++++++++++++++++ setup.py | 14 +++++++++ 2 files changed, 57 insertions(+) create mode 100644 .github/workflows/python-publish.yml create mode 100644 setup.py diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..e0d50cc --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,43 @@ +# 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.x' + - name: Prepare version + run: | + # get release version + VERSION=$(echo $GITHUB_REF | sed 's#.*/v##') + + # file and content that will be replaced + PLACEHOLDER="version='default'" + SETUP_FILE="setup.py" + + # check to see that content is in file, then replace to have latest release version + grep "${PLACEHOLDER}" "${SETUP_FILE}" + sed -i "s/$PLACEHOLDER/version='${VERSION}'/g" ${SETUP_FILE} + - 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/* \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..00e88f2 --- /dev/null +++ b/setup.py @@ -0,0 +1,14 @@ +from setuptools import setup, find_packages + +setup( + name='PyGithubFork', + version='default', + description='Code wraps PyGithub to simplify workflows dealing with forks', + author='hassenius', + url='https://github.com/multicloud-ops/PyGithubFork', + packages=['githubfork'] + # install_requires=[ + # 'pyyaml', + # 'pygithub' + # ] +) \ No newline at end of file