Repository: modin-project/modin

Issue:
BUG: Release notes script isn't handling bad or pre-release versions correctly
### Modin version checks

- [X] I have checked that this issue has not already been reported.

- [X] I have confirmed this bug exists on the latest released version of Modin.

- [X] I have confirmed this bug exists on the main branch of Modin. (In order to do this you can follow [this guide](https://modin.readthedocs.io/en/stable/getting_started/installation.html#installing-from-the-github-master-branch).)


### Reproducible Example

```python
python scripts/release.py notes
```


### Issue Description

Invalid tag causes exception.

Not skipping pre-releases causes wrong detection of previous release (example of building notes for `0.22.3` and latest release being detected as `0.23.0rc0`):
```
Detected release type: patch
Previous patch release: refs/tags/0.23.0rc0
Computing release notes for 0.23.0rc0 -> 0.23.1...
Current HEAD is not derived from previous release: did you forget to checkout correct branch or pull tags?
```

### Expected Behavior

no exceptions and correct previous version detected

### Error Logs

<details>

```python-traceback

Traceback (most recent call last):
  File "c:\Vass\Ponder\modin\scripts\release.py", line 276, in <module>
    main()
  File "c:\Vass\Ponder\modin\scripts\release.py", line 272, in main
    sys.exit(args.func(args))
  File "c:\Vass\Ponder\modin\scripts\release.py", line 154, in make_notes
    prev_ref, prev_commit, prev_ver = wrapper.get_previous_release(release_type)
  File "c:\Vass\Ponder\modin\scripts\release.py", line 117, in get_previous_release
    tags = [
  File "c:\Vass\Ponder\modin\scripts\release.py", line 118, in <listcomp>
    (entry, version.parse(entry.lstrip("refs/tags/")))
  File "C:\Users\Vass\.conda\envs\modin\lib\site-packages\packaging\version.py", line 52, in parse
    return Version(version)
  File "C:\Users\Vass\.conda\envs\modin\lib\site-packages\packaging\version.py", line 198, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: 'Modin-v0.1.0'

```

</details>


### Installed Versions

irrelevant


Discussion:

Resolving patch:
diff --git a/scripts/release.py b/scripts/release.py
--- a/scripts/release.py
+++ b/scripts/release.py
@@ -113,14 +113,26 @@ def __init__(self):
     def is_on_master(self):
         return self.repo.references["refs/heads/master"] == self.repo.head
 
+    @staticmethod
+    def __get_tag_version(entry):
+        try:
+            return version.parse(entry.lstrip("refs/tags/"))
+        except version.InvalidVersion as ex:
+            return f'<bad version "{entry}": {ex}>'
+
     def get_previous_release(self, rel_type):
         tags = [
-            (entry, version.parse(entry.lstrip("refs/tags/")))
+            (entry, self.__get_tag_version(entry))
             for entry in self.repo.references
             if entry.startswith("refs/tags/")
         ]
-        # filter away legacy versions (which aren't following the proper naming schema)
-        tags = [(entry, ver) for entry, ver in tags if isinstance(ver, version.Version)]
+        # filter away legacy versions (which aren't following the proper naming schema);
+        # also skip pre-releases
+        tags = [
+            (entry, ver)
+            for entry, ver in tags
+            if isinstance(ver, version.Version) and not ver.pre
+        ]
         if rel_type == "minor":
             # leave only minor releases
             tags = [(entry, ver) for entry, ver in tags if ver.micro == 0]


Test patch: