Skip to content

Commit

Permalink
fix more version number problems
Browse files Browse the repository at this point in the history
  • Loading branch information
renxida committed Jun 25, 2024
1 parent dc43d6e commit 80c20d0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,24 @@ jobs:
- name: Determine new version
id: version
run: |
current_version=$(grep -oP "__version__ = '\K[^']+" uniclip/__init__.py)
current_version=$(python -c "
import re
with open('uniclip/__init__.py', 'r') as f:
content = f.read()
match = re.search(r\"__version__\s*=\s*['\\\"]([^'\\\"]*)['\\\"]\", content)
if match:
print(match.group(1))
else:
print('0.0.0') # fallback version
")
new_version=$(python -c "import semver; print(str(semver.VersionInfo.parse('$current_version').bump_${{ github.event.inputs.release_type }}()))")
echo "Current version: $current_version"
echo "New version will be: $new_version"
echo "new_version=$new_version" >> $GITHUB_OUTPUT
- name: Update version
run: |
sed -i "s/__version__ = .*/__version__ = '${{ steps.version.outputs.new_version }}'/" uniclip/__init__.py
sed -i "s/__version__\s*=\s*['\"].*['\"]/__version__ = '${{ steps.version.outputs.new_version }}'/" uniclip/__init__.py
- name: Commit version update
run: |
Expand Down
5 changes: 3 additions & 2 deletions uniclip/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .main import main
__version__ = '0.1.0'

__version__ = "0.1.0"

from .main import main

0 comments on commit 80c20d0

Please sign in to comment.