Skip to content

Commit e4f16c1

Browse files
committed
Adjust publish workflow
1 parent 3092291 commit e4f16c1

File tree

3 files changed

+49
-28
lines changed

3 files changed

+49
-28
lines changed

.github/workflows/publish-to-pypi.yml

+3-9
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,10 @@ jobs:
1919
python-version: 3.8
2020
- name: Set Version
2121
id: version
22-
run: |
23-
if [[ "${{ github.event_name }}" == "release" && "${{ github.event.action }}" == "published" ]]; then
24-
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
25-
else
26-
TIMESTAMP=$(date +'%Y%m%d%H%M%S')
27-
echo "VERSION=0.0.dev${TIMESTAMP}" >> $GITHUB_ENV
28-
fi
22+
run: echo "${GITHUB_REF#refs/tags/}" > polypheny-connector-version.txt
23+
- name: Create MANIFEST.in
24+
run: echo "include polypheny-connector-version.txt" > MANIFEST.in
2925
- name: Build package
3026
run: python setup.py sdist
31-
env:
32-
VERSION: ${{ env.VERSION }}
3327
- name: Publish distribution 📦 to PyPI
3428
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yaml

+12
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ jobs:
3232
with:
3333
distribution: 'temurin'
3434
java-version: '17'
35+
36+
- name: Set Version
37+
id: version
38+
run: echo "v0.0.0" > polypheny-connector-version.txt
3539

3640
- name: Checkout driver
3741
uses: actions/checkout@v4
@@ -90,6 +94,10 @@ jobs:
9094
distribution: 'temurin'
9195
java-version: '17'
9296

97+
- name: Set Version
98+
id: version
99+
run: echo "v0.0.0" > polypheny-connector-version.txt
100+
93101
- name: Checkout driver
94102
uses: actions/checkout@v4
95103
with:
@@ -137,6 +145,10 @@ jobs:
137145
- name: Checkout driver
138146
uses: actions/checkout@v4
139147

148+
- name: Set Version
149+
id: version
150+
run: echo "v0.0.0" > polypheny-connector-version.txt
151+
140152
- name: Install driver dependencies
141153
run: pip install -r requirements.txt
142154

setup.py

+34-19
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,42 @@
11
import os
2-
import sys
3-
42
from setuptools import setup
53

6-
# Retrieve 'VERSION' environment variable, default to '0.0' if not found.
7-
version = os.getenv('RELEASE_VERSION', '0.0')
4+
version_file = 'polypheny-connector-version.txt'
5+
6+
if not os.path.exists(version_file):
7+
raise ValueError(f"Version file '{version_file}' not found. Please create the file with the version number.")
8+
9+
with open(version_file, 'r') as f:
10+
version = f.read().strip()
11+
12+
print(f"Building version: {version}")
13+
14+
if not version.startswith('v'):
15+
raise ValueError(f"Invalid version format: {version}. Expected format 'v0.0.0'.")
816

9-
# Attempt to split the version number, default to '0' for both if it fails
10-
try:
11-
major, minor = version.split('.')
12-
except ValueError:
13-
major, minor = '0', '0' # Default to '0.0' if the version isn't in a 'major.minor' format
17+
# Strip the 'v' prefix for the version
18+
version = version[1:]
1419

1520
with open('README.md', 'r', encoding='utf-8') as f:
1621
long_description = f.read()
1722

18-
setup(name='polypheny',
19-
version=version,
20-
description='Driver for Polypheny',
21-
long_description=long_description,
22-
long_description_content_type='text/markdown',
23-
packages=['polypheny'],
24-
install_requires=[
25-
"polypheny-prism-api==1.9",
26-
],
27-
)
23+
setup(
24+
name='polypheny',
25+
version=version,
26+
description='Driver for Polypheny',
27+
long_description=long_description,
28+
long_description_content_type='text/markdown',
29+
author="The Polypheny Project",
30+
author_email="[email protected]",
31+
url="https://polypheny.com/",
32+
project_urls={
33+
"Documentation": "https://docs.polypheny.com/en/latest/drivers/python/overview",
34+
"Code": "https://github.com/polypheny/Polypheny-Connector-Python",
35+
"Issue tracker": "https://github.com/polypheny/Polypheny-DB/labels/A-python"
36+
},
37+
license="Apache License, Version 2.0",
38+
packages=['polypheny'],
39+
install_requires=[
40+
"polypheny-prism-api==1.9",
41+
],
42+
)

0 commit comments

Comments
 (0)