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 : |
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 :
0 commit comments