Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions .github/workflows/build-test-and-sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,20 +152,20 @@ jobs:
name: power-grid-model-ds
path: wheelhouse/

# - name: Upload wheels
# if: (github.event_name == 'push') || ((github.event_name == 'workflow_dispatch') && (github.event.inputs.create_release == 'true'))
# run: |
# pip install twine
# echo "Publish to PyPI..."
# twine upload --verbose wheelhouse/*

# - name: Release
# if: (github.event_name == 'push') || ((github.event_name == 'workflow_dispatch') && (github.event.inputs.create_release == 'true'))
# uses: softprops/action-gh-release@v2
# with:
# files: |
# ./wheelhouse/*
# tag_name: v${{ needs.build-python.outputs.version }}
# prerelease: ${{github.ref != 'refs/heads/main'}}
# generate_release_notes: true
# target_commitish: ${{ github.sha }}
- name: Upload wheels
if: (github.event_name == 'push') || ((github.event_name == 'workflow_dispatch') && (github.event.inputs.create_release == 'true'))
run: |
pip install twine
echo "Publish to PyPI..."
twine upload --verbose wheelhouse/*

- name: Release
if: (github.event_name == 'push') || ((github.event_name == 'workflow_dispatch') && (github.event.inputs.create_release == 'true'))
uses: softprops/action-gh-release@v2
with:
files: |
./wheelhouse/*
tag_name: v${{ needs.build-python.outputs.version }}
prerelease: ${{github.ref != 'refs/heads/main'}}
generate_release_notes: true
target_commitish: ${{ github.sha }}
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0
1.0
11 changes: 8 additions & 3 deletions set_pypi_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@


import os
import re
from pathlib import Path

import requests
Expand Down Expand Up @@ -44,9 +45,13 @@ def get_pypi_latest():
response = requests.get("https://pypi.org/pypi/power-grid-model-ds/json")
if response.status_code == 404:
return 0, 0, 0
data = response.json()
version = str(data["info"]["version"])
return (int(x) for x in version.split("."))
version = str(response.json()["info"]["version"])

version_pattern = re.compile(r"^\d+\.\d+\.\d+")
match = version_pattern.match(version)
if not match:
raise ValueError(f"Invalid version format: {version}")
return (int(x) for x in match.group(0).split("."))


def get_new_version(major, minor, latest_major, latest_minor, latest_patch):
Expand Down
Loading