Skip to content

Commit

Permalink
Adjust publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
vogti committed May 17, 2024
1 parent 3092291 commit 549b9a7
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 29 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,10 @@ jobs:
python-version: 3.8
- name: Set Version
id: version
run: |
if [[ "${{ github.event_name }}" == "release" && "${{ github.event.action }}" == "published" ]]; then
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
else
TIMESTAMP=$(date +'%Y%m%d%H%M%S')
echo "VERSION=0.0.dev${TIMESTAMP}" >> $GITHUB_ENV
fi
run: echo "${GITHUB_REF#refs/tags/}" > polypheny-connector-version.txt
- name: Create MANIFEST.in
run: echo "include polypheny-connector-version.txt" > MANIFEST.in
- name: Build package
run: python setup.py sdist
env:
VERSION: ${{ env.VERSION }}
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
23 changes: 22 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ jobs:
with:
distribution: 'temurin'
java-version: '17'


- name: Set Version
id: version
run: echo "v0.0.0" > polypheny-connector-version.txt

- name: Create MANIFEST.in
run: echo "include polypheny-connector-version.txt" > MANIFEST.in

- name: Checkout driver
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -90,6 +97,13 @@ jobs:
distribution: 'temurin'
java-version: '17'

- name: Set Version
id: version
run: echo "v0.0.0" > polypheny-connector-version.txt

- name: Create MANIFEST.in
run: echo "include polypheny-connector-version.txt" > MANIFEST.in

- name: Checkout driver
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -137,6 +151,13 @@ jobs:
- name: Checkout driver
uses: actions/checkout@v4

- name: Set Version
id: version
run: echo "v0.0.0" > polypheny-connector-version.txt

- name: Create MANIFEST.in
run: echo "include polypheny-connector-version.txt" > MANIFEST.in

- name: Install driver dependencies
run: pip install -r requirements.txt

Expand Down
53 changes: 34 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,42 @@
import os
import sys

from setuptools import setup

# Retrieve 'VERSION' environment variable, default to '0.0' if not found.
version = os.getenv('RELEASE_VERSION', '0.0')
version_file = 'polypheny-connector-version.txt'

if not os.path.exists(version_file):
raise ValueError(f"Version file '{version_file}' not found. Please create the file with the version number.")

with open(version_file, 'r') as f:
version = f.read().strip()

print(f"Building version: {version}")

if not version.startswith('v'):
raise ValueError(f"Invalid version format: {version}. Expected format 'v0.0.0'.")

# Attempt to split the version number, default to '0' for both if it fails
try:
major, minor = version.split('.')
except ValueError:
major, minor = '0', '0' # Default to '0.0' if the version isn't in a 'major.minor' format
# Strip the 'v' prefix for the version
version = version[1:]

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

setup(name='polypheny',
version=version,
description='Driver for Polypheny',
long_description=long_description,
long_description_content_type='text/markdown',
packages=['polypheny'],
install_requires=[
"polypheny-prism-api==1.9",
],
)
setup(
name='polypheny',
version=version,
description='Driver for Polypheny',
long_description=long_description,
long_description_content_type='text/markdown',
author="The Polypheny Project",
author_email="[email protected]",
url="https://polypheny.com/",
project_urls={
"Documentation": "https://docs.polypheny.com/en/latest/drivers/python/overview",
"Code": "https://github.com/polypheny/Polypheny-Connector-Python",
"Issue tracker": "https://github.com/polypheny/Polypheny-DB/labels/A-python"
},
license="Apache License, Version 2.0",
packages=['polypheny'],
install_requires=[
"polypheny-prism-api==1.9",
],
)

0 comments on commit 549b9a7

Please sign in to comment.