Skip to content

Commit fdb4299

Browse files
authored
Merge pull request #2 from DenverCoderOne/pypi-setup
2 parents b182dcb + c615360 commit fdb4299

File tree

2 files changed

+73
-9
lines changed

2 files changed

+73
-9
lines changed

.github/workflows/python-publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
workflow_dispatch:
15+
16+
jobs:
17+
deploy:
18+
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: Set up Python
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: '3.x'
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install build
31+
- name: Build package
32+
run: python -m build
33+
- name: Publish package
34+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
35+
with:
36+
user: __token__
37+
password: ${{ secrets.PYPI_API_TOKEN }}

setup.py

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
from setuptools import setup
23
import re
34

@@ -25,12 +26,38 @@
2526
except Exception:
2627
pass
2728

28-
setup(name='nextcord-ext-menus',
29-
author='Nextcord Developers',
30-
url='https://github.com/nextcord/nextcord-ext-menus',
31-
version=version,
32-
packages=['nextcord.ext.menus'],
33-
license='MIT',
34-
description='An extension module to make reaction based menus with nextcord',
35-
python_requires='>=3.6.0'
36-
)
29+
30+
def long_description():
31+
# check if README.md exists
32+
if not os.path.exists("README.md"):
33+
return ""
34+
# return README contents
35+
with open("README.md", "r") as fh:
36+
return fh.read()
37+
38+
39+
def requirements():
40+
# check if requirements.txt exists
41+
if not os.path.exists("requirements.txt"):
42+
return []
43+
# return requirements.txt contents
44+
with open("requirements.txt") as f:
45+
return f.read().splitlines()
46+
47+
48+
setup(
49+
name="nextcord-ext-menus",
50+
version=version,
51+
author="Nextcord Developers",
52+
description="An extension module to make reaction based menus with nextcord",
53+
long_description=long_description(),
54+
long_description_content_type="text/markdown",
55+
url="https://github.com/nextcord/nextcord-ext-menus",
56+
project_urls={
57+
"Bug Tracker": "https://github.com/nextcord/nextcord-ext-menus/issues",
58+
},
59+
packages=['nextcord.ext.menus'],
60+
license='MIT',
61+
python_requires=">=3.8.0",
62+
install_requires=[requirements()]
63+
)

0 commit comments

Comments
 (0)