Skip to content

Commit b660ae6

Browse files
committed
update version management
1 parent 5b2235c commit b660ae6

File tree

4 files changed

+36
-14
lines changed

4 files changed

+36
-14
lines changed

.github/workflows/publish-sdk.yml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
- uses: actions/checkout@v3
2424
with:
2525
fetch-depth: 0
26+
ref: ${{ github.ref }}
2627

2728
- name: Set up Python
2829
uses: actions/setup-python@v4
@@ -35,13 +36,30 @@ jobs:
3536
pip install build twine
3637
pip install -e ".[dev]"
3738
38-
- name: Update version in setup.py
39+
- name: Update version in __version__.py
3940
run: |
40-
sed -i "s/version=\".*\"/version=\"${{ inputs.version }}\"/" setup.py
41+
echo '"""Version information for DataSpace SDK."""' > dataspace_sdk/__version__.py
42+
echo "" >> dataspace_sdk/__version__.py
43+
echo "__version__ = \"${{ inputs.version }}\"" >> dataspace_sdk/__version__.py
4144
42-
- name: Update version in pyproject.toml
45+
- name: Update version in pyproject.toml (if exists)
4346
run: |
44-
sed -i "s/version = \".*\"/version = \"${{ inputs.version }}\"/" pyproject.toml
47+
if [ -f pyproject.toml ]; then
48+
sed -i "s/version = \".*\"/version = \"${{ inputs.version }}\"/" pyproject.toml
49+
fi
50+
51+
- name: Commit and push version changes
52+
run: |
53+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
54+
git config --local user.name "github-actions[bot]"
55+
git add dataspace_sdk/__version__.py
56+
if [ -f pyproject.toml ]; then git add pyproject.toml; fi
57+
git commit -m "Bump SDK version to ${{ inputs.version }}" || echo "No changes to commit"
58+
59+
# Get current branch name
60+
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
61+
echo "Pushing to branch: $BRANCH_NAME"
62+
git push origin $BRANCH_NAME || echo "No changes to push"
4563
4664
- name: Run tests
4765
run: |
@@ -65,14 +83,6 @@ jobs:
6583
run: |
6684
twine upload dist/*
6785
68-
- name: Commit version changes
69-
run: |
70-
git config --local user.email "github-actions[bot]@users.noreply.github.com"
71-
git config --local user.name "github-actions[bot]"
72-
git add setup.py pyproject.toml
73-
git commit -m "Bump version to ${{ inputs.version }}" || echo "No changes to commit"
74-
git push || echo "No changes to push"
75-
7686
- name: Create GitHub Release
7787
uses: actions/create-release@v1
7888
env:

dataspace_sdk/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""DataSpace Python SDK for programmatic access to DataSpace resources."""
22

3+
from dataspace_sdk.__version__ import __version__
34
from dataspace_sdk.client import DataSpaceClient
45
from dataspace_sdk.exceptions import (
56
DataSpaceAPIError,
@@ -8,7 +9,6 @@
89
DataSpaceValidationError,
910
)
1011

11-
__version__ = "0.1.0"
1212
__all__ = [
1313
"DataSpaceClient",
1414
"DataSpaceAPIError",

dataspace_sdk/__version__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""Version information for DataSpace SDK."""
2+
3+
__version__ = "0.3.0"

setup.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
"""Setup configuration for DataSpace Python SDK."""
22

3+
import os
4+
from typing import Any, Dict
5+
36
from setuptools import find_packages, setup
47

8+
# Read version from __version__.py
9+
version: Dict[str, Any] = {}
10+
version_file = os.path.join(os.path.dirname(__file__), "dataspace_sdk", "__version__.py")
11+
with open(version_file, "r", encoding="utf-8") as f:
12+
exec(f.read(), version)
13+
514
with open("docs/sdk/README.md", "r", encoding="utf-8") as fh:
615
long_description = fh.read()
716

817
setup(
918
name="dataspace-sdk",
10-
version="0.1.0",
19+
version=version["__version__"],
1120
author="CivicDataLab",
1221
author_email="[email protected]",
1322
description="Python SDK for DataSpace API - programmatic access to datasets, AI models, and use cases",

0 commit comments

Comments
 (0)