Skip to content

Commit 51e63c0

Browse files
committed
chore: automatically build and deploy to pypi
1 parent 22ded51 commit 51e63c0

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Build & Deploy to PyPI on Release
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
jobs:
8+
deploy:
9+
name: PyPI Deploy
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-python@v2
14+
- id: dist
15+
uses: casperdcl/deploy-pypi@v2
16+
with:
17+
requirements: twine setuptools wheel
18+
build: true
19+
password: ${{ secrets.PYPI_TOKEN }}
20+
upload: true

setup.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import setuptools
2-
from statsapi import version
2+
from distutils.util import convert_path
3+
4+
# https://stackoverflow.com/questions/2058802/how-can-i-get-the-version-defined-in-setup-py-setuptools-in-my-package
5+
main_ns = {}
6+
ver_path = convert_path("statsapi/version.py")
7+
with open(ver_path) as ver_file:
8+
exec(ver_file.read(), main_ns)
39

410
with open("README.md", "r") as fh:
511
long_description = fh.read()
612

713
setuptools.setup(
814
name="MLB-StatsAPI",
9-
version=version.VERSION,
15+
version=main_ns["VERSION"],
1016
author="Todd Roberts",
1117
author_email="todd@toddrob.com",
1218
description="MLB Stats API Wrapper for Python",

0 commit comments

Comments
 (0)