From 93c87fcd73e0b469c6b3cb9f919b96f68eafbe1a Mon Sep 17 00:00:00 2001 From: DARKZOUL5 Date: Wed, 3 Jun 2026 16:46:37 +0300 Subject: [PATCH] update project name --- .../workflows/refresh-yt-dlp-and-release.yml | 140 ++++++++++++++++++ ...n_youtube_playlist_sync_conversion_plan.md | 3 - pyproject.toml | 2 +- 3 files changed, 141 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/refresh-yt-dlp-and-release.yml diff --git a/.github/workflows/refresh-yt-dlp-and-release.yml b/.github/workflows/refresh-yt-dlp-and-release.yml new file mode 100644 index 0000000..1d57a72 --- /dev/null +++ b/.github/workflows/refresh-yt-dlp-and-release.yml @@ -0,0 +1,140 @@ +name: update yt-dlp and release patch + +on: + schedule: + - cron: "0 10 * * *" + workflow_dispatch: + +permissions: + contents: write + +concurrency: + group: refresh-yt-dlp-release + cancel-in-progress: true + +jobs: + refresh: + name: Update yt-dlp dependency + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.12" + + - name: Detect updates + id: detect + shell: bash + run: | + set -euo pipefail + git fetch --tags --force + + python - <<'PY' >> "$GITHUB_OUTPUT" + from __future__ import annotations + + import json + import re + from pathlib import Path + from urllib.request import urlopen + + def version_tuple(text: str) -> tuple[int, ...]: + parts = re.findall(r"\d+", text) + return tuple(int(p) for p in parts) + + pyproject = Path("pyproject.toml") + text = pyproject.read_text(encoding="utf-8") + + dep_match = re.search(r'^\s*"yt-dlp>=(?P[^"]+)"\s*,?\s*$', text, re.MULTILINE) + if not dep_match: + raise SystemExit("Could not find yt-dlp dependency in pyproject.toml") + + dep_version = dep_match.group("version") + + latest_payload = urlopen("https://pypi.org/pypi/yt-dlp/json", timeout=30) + latest_version = json.load(latest_payload)["info"]["version"] + + tag_output = __import__("subprocess").check_output( + ["git", "tag", "--sort=-creatordate", "v*"], + text=True, + ).splitlines() + latest_tag = next((tag for tag in tag_output if tag.startswith("v")), None) + if latest_tag is None: + raise SystemExit("No existing v* tag found") + + needs_update = version_tuple(latest_version) > version_tuple(dep_version) + + print(f"needs_update={'true' if needs_update else 'false'}") + print(f"latest_yt_dlp={latest_version}") + print(f"current_yt_dlp={dep_version}") + print(f"current_tag={latest_tag}") + if latest_tag.startswith("v"): + current_version = latest_tag[1:] + print(f"next_version={current_version.rsplit('.', 1)[0]}.{int(current_version.rsplit('.', 1)[1]) + 1}") + PY + + - name: Update pyproject + if: steps.detect.outputs.needs_update == 'true' + shell: bash + env: + NEW_YTDLP_VERSION: ${{ steps.detect.outputs.latest_yt_dlp }} + NEW_PROJECT_VERSION: ${{ steps.detect.outputs.next_version }} + run: | + set -euo pipefail + python - <<'PY' + from pathlib import Path + import os + import re + + pyproject = Path("pyproject.toml") + text = pyproject.read_text(encoding="utf-8") + + project_version = os.environ["NEW_PROJECT_VERSION"] + ytdlp_version = os.environ["NEW_YTDLP_VERSION"] + + text = re.sub( + r'(^version\s*=\s*")[^"]+(")', + rf'\g<1>{project_version}\2', + text, + flags=re.MULTILINE, + ) + text = re.sub( + r'(^\s*"yt-dlp>=)[^"]+(")', + rf'\g<1>{ytdlp_version}\2', + text, + flags=re.MULTILINE, + ) + + pyproject.write_text(text, encoding="utf-8") + PY + + - name: Commit and push update + if: steps.detect.outputs.needs_update == 'true' + shell: bash + env: + PROJECT_VERSION: ${{ steps.detect.outputs.next_version }} + YTDLP_VERSION: ${{ steps.detect.outputs.latest_yt_dlp }} + run: | + set -euo pipefail + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + git add pyproject.toml + git commit -m "chore: bump yt-dlp to ${YTDLP_VERSION} and release v${PROJECT_VERSION}" + git push origin HEAD:${GITHUB_REF_NAME} + + - name: Create and push release tag + if: steps.detect.outputs.needs_update == 'true' + shell: bash + env: + PROJECT_VERSION: ${{ steps.detect.outputs.next_version }} + run: | + set -euo pipefail + TAG="v${PROJECT_VERSION}" + git tag "${TAG}" + git push origin "${TAG}" diff --git a/plans/python_youtube_playlist_sync_conversion_plan.md b/plans/python_youtube_playlist_sync_conversion_plan.md index 51d5979..baea017 100644 --- a/plans/python_youtube_playlist_sync_conversion_plan.md +++ b/plans/python_youtube_playlist_sync_conversion_plan.md @@ -1,8 +1,5 @@ # YouTube Playlist Sync — Project Conversion Plan -Repository: - -- [darkzoul5/YoutubePlaylistDownloader](https://github.com/darkzoul5/YoutubePlaylistDownloader?utm_source=chatgpt.com) --- diff --git a/pyproject.toml b/pyproject.toml index e76b5e1..9b9b9cf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "ytpl-sync" version = "1.1.1" -description = "YouTube playlist Sync Thing" +description = "YouTube playlist Sync" readme = "README.md" authors = [ { name = "Dark_Zoul" } ] license = { file = "LICENSE" }