Skip to content

Commit 549b9a7

Browse files
committed
Adjust publish workflow
1 parent 3092291 commit 549b9a7

File tree

3 files changed

+59
-29
lines changed

3 files changed

+59
-29
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

+22-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,14 @@ jobs:
3232
with:
3333
distribution: 'temurin'
3434
java-version: '17'
35-
35+
36+
- name: Set Version
37+
id: version
38+
run: echo "v0.0.0" > polypheny-connector-version.txt
39+
40+
- name: Create MANIFEST.in
41+
run: echo "include polypheny-connector-version.txt" > MANIFEST.in
42+
3643
- name: Checkout driver
3744
uses: actions/checkout@v4
3845
with:
@@ -90,6 +97,13 @@ jobs:
9097
distribution: 'temurin'
9198
java-version: '17'
9299

100+
- name: Set Version
101+
id: version
102+
run: echo "v0.0.0" > polypheny-connector-version.txt
103+
104+
- name: Create MANIFEST.in
105+
run: echo "include polypheny-connector-version.txt" > MANIFEST.in
106+
93107
- name: Checkout driver
94108
uses: actions/checkout@v4
95109
with:
@@ -137,6 +151,13 @@ jobs:
137151
- name: Checkout driver
138152
uses: actions/checkout@v4
139153

154+
- name: Set Version
155+
id: version
156+
run: echo "v0.0.0" > polypheny-connector-version.txt
157+
158+
- name: Create MANIFEST.in
159+
run: echo "include polypheny-connector-version.txt" > MANIFEST.in
160+
140161
- name: Install driver dependencies
141162
run: pip install -r requirements.txt
142163

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)