From 1b30d3b5321d48c53115b9738d1cf697c62f60d1 Mon Sep 17 00:00:00 2001 From: Soban Javed Date: Tue, 30 Mar 2021 23:59:02 +0500 Subject: [PATCH 1/2] build: release on pypi through github actions --- .github/workflows/pypi-release.yml | 33 ++++++++++++++++++++++++++++++ .gitignore | 7 +++++++ setup.py | 14 ++++++------- 3 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/pypi-release.yml diff --git a/.github/workflows/pypi-release.yml b/.github/workflows/pypi-release.yml new file mode 100644 index 0000000..ed4af27 --- /dev/null +++ b/.github/workflows/pypi-release.yml @@ -0,0 +1,33 @@ +name: Publish package to PyPi + +on: + release: + types: [published] + +jobs: + + push: + runs-on: ubuntu-20.04 + + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: setup python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install pip + run: pip install pip + + - name: Install Dependencies + run: pip install setuptools wheel + + - name: Build package + run: python setup.py sdist bdist_wheel + + - name: Publish to PyPi + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_UPLOAD_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 16cd01f..2beb88f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,9 @@ .DS_STORE *.swp + +# Packages +*.egg +*.egg-info +dist +build +eggs \ No newline at end of file diff --git a/setup.py b/setup.py index a1f287b..a6deb87 100644 --- a/setup.py +++ b/setup.py @@ -46,13 +46,11 @@ def is_requirement(line): return line and not line.startswith(('-r', '#', '-e', 'git+', '-c')) -VERSION = get_version('warnings_report', '__init__.py') - -if sys.argv[-1] == 'tag': - print("Tagging the version on github:") - os.system(u"git tag -a %s -m 'version %s'" % (VERSION, VERSION)) - os.system("git push --tags") - sys.exit() +# if sys.argv[-1] == 'tag': +# print("Tagging the version on github:") +# os.system(u"git tag -a %s -m 'version %s'" % (VERSION, VERSION)) +# os.system("git push --tags") +# sys.exit() README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read() CHANGELOG = open(os.path.join(os.path.dirname(__file__), 'CHANGELOG.rst')).read() @@ -68,7 +66,7 @@ def is_requirement(line): license='AGPL', url='https://github.com/edx/pytest-warnings-report', description='A pytest plugin for generating warnings reports.', - long_description=read('README.rst'), + long_description=README, py_modules=['pytest_warnings_report'], python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*', include_package_data=True, From 9981d9bd484abdb6feca72d2db68abd007b738d1 Mon Sep 17 00:00:00 2001 From: Muhammad Soban Javed <58461728+iamsobanjaved@users.noreply.github.com> Date: Wed, 14 Apr 2021 12:58:14 +0500 Subject: [PATCH 2/2] updated setup.py --- setup.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index a6deb87..e14bf6a 100644 --- a/setup.py +++ b/setup.py @@ -46,11 +46,11 @@ def is_requirement(line): return line and not line.startswith(('-r', '#', '-e', 'git+', '-c')) -# if sys.argv[-1] == 'tag': -# print("Tagging the version on github:") -# os.system(u"git tag -a %s -m 'version %s'" % (VERSION, VERSION)) -# os.system("git push --tags") -# sys.exit() +if sys.argv[-1] == 'tag': + print("Tagging the version on github:") + os.system(u"git tag -a %s -m 'version %s'" % (VERSION, VERSION)) + os.system("git push --tags") + sys.exit() README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read() CHANGELOG = open(os.path.join(os.path.dirname(__file__), 'CHANGELOG.rst')).read()