-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.py
38 lines (33 loc) · 1.03 KB
/
publish.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import subprocess
import os
from dotenv import load_dotenv
# Load environment variables
load_dotenv()
# List of commands
commands = [
"cython shuttleasgi/url.pyx",
"cython shuttleasgi/exceptions.pyx",
"cython shuttleasgi/headers.pyx",
"cython shuttleasgi/cookies.pyx",
"cython shuttleasgi/contents.pyx",
"cython shuttleasgi/messages.pyx",
"cython shuttleasgi/scribe.pyx",
"cython shuttleasgi/baseapp.pyx",
"python setup.py build_ext --inplace",
"python setup.py sdist",
"python setup.py bdist_wheel",
]
# Execute each command
for command in commands:
process = subprocess.run(command, shell=True, check=True)
if process.returncode != 0:
print(f"Command failed: {command}")
else:
print(f"Command succeeded: {command}")
pypi_token = os.getenv("PYPI_TOKEN")
# Upload to PyPI
twine = subprocess.run(f"twine upload dist/* -u __token__ -p {pypi_token} --non-interactive", shell=True, check=True)
if twine.returncode != 0:
print("Twine failed")
else:
print("Twine succeeded")