Skip to content

Commit 2b9d6c3

Browse files
authored
Merge pull request #1 from ExperQuick/dev
Dev
2 parents 7652514 + 3d7c79b commit 2b9d6c3

3 files changed

Lines changed: 78 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.11'
18+
19+
- name: Install build tools
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install build
23+
24+
25+
# Clean old builds before build
26+
- name: Clean old builds
27+
run: rm -rf dist
28+
29+
- name: Build package
30+
run: python -m build
31+
32+
- name: Upload dist artifact
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: dist-files
36+
path: dist/
37+
38+
publish:
39+
needs: build
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Download dist artifact
43+
uses: actions/download-artifact@v4
44+
with:
45+
name: dist-files
46+
path: dist/
47+
48+
- name: Set up Python
49+
uses: actions/setup-python@v5
50+
with:
51+
python-version: '3.11'
52+
53+
- name: Install Twine
54+
run: pip install twine
55+
56+
- name: Publish to PyPI or TestPyPI
57+
env:
58+
TWINE_USERNAME: __token__
59+
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
60+
run: |
61+
echo "🚀 Publishing to PyPI"
62+
twine upload --verbose -u __token__ -p "$PYPI_TOKEN" dist/*
63+

setup.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,22 @@
1515

1616
from setuptools import setup, find_packages
1717

18+
def get_version():
19+
version_file = os.path.join('src', 'plf', '_version.py')
20+
with open(version_file) as f:
21+
for line in f:
22+
if line.strip().startswith('__version__'):
23+
# Extract the version string between quotes
24+
parts = line.split('=', 1)
25+
if len(parts) == 2:
26+
version_str = parts[1].strip().strip('"\'')
27+
return version_str
28+
break
29+
raise RuntimeError("Unable to find version string in _version.py.")
30+
1831
setup(
1932
name='PyLabFlow',
20-
version='0.2.1',
33+
version=get_version(),
2134
package_dir={'': 'src'},
2235
packages=find_packages(where='src'),
2336
include_package_data=True,

src/plf/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.2.1.1"

0 commit comments

Comments
 (0)