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
23 changes: 19 additions & 4 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version: '3.12'

- name: Install dependencies
run: |
Expand All @@ -33,6 +33,7 @@ jobs:
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: |
python - <<'PY'
import ast
import os
import pathlib
import sys
Expand All @@ -42,9 +43,22 @@ jobs:
pyproject_data = tomllib.loads((root / "pyproject.toml").read_text(encoding="utf-8"))
pyproject_version = pyproject_data["project"]["version"]

namespace = {}
exec((root / "ytlookup" / "__init__.py").read_text(encoding="utf-8"), namespace)
init_version = namespace.get("__version__")
init_text = (root / "ytlookup" / "__init__.py").read_text(encoding="utf-8")
init_tree = ast.parse(init_text)
init_version = None
for node in init_tree.body:
if isinstance(node, ast.Assign):
for target in node.targets:
if isinstance(target, ast.Name) and target.id == "__version__":
if isinstance(node.value, ast.Constant) and isinstance(node.value.value, str):
init_version = node.value.value
break
if init_version is not None:
break

if init_version is None:
print("Could not find __version__ string assignment in ytlookup/__init__.py")
sys.exit(1)

release_tag = os.environ["RELEASE_TAG"]
normalized_tag = release_tag[1:] if release_tag.startswith("v") else release_tag
Expand Down Expand Up @@ -85,6 +99,7 @@ jobs:
path: dist/

- name: Publish package
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "ytlookup"
version = "1.0.0"
version = "1.0.1"
description = "Blazing-fast async YouTube search library - no API key required"
readme = "README.md"
requires-python = ">=3.8"
Expand Down
2 changes: 1 addition & 1 deletion ytlookup/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .video import Video
from .playlist import Playlist

__version__ = "1.0.0"
__version__ = "1.0.1"
__author__ = "Certified Coders"
__license__ = "MIT"

Expand Down
Loading