diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..e2bf73a --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,30 @@ +pipeline { + agent any + + environment { + PYPI_TOKEN = credentials('pypi_token') + } + + stages { + stage('Checkout'){ + steps { + checkout scm + } + } + stage('Build and publish pypi package') { + when { expression { sh([returnStdout: true, script: "git tag -l --contains $GIT_COMMIT | grep '^v' || true"]) } } + steps { + sh ''' + # If we are within docker, we need to hack around to get the volume mount path on the host system for our docker runs down below + if docker inspect `hostname` 2>/dev/null; then + DOCKER_VOLUME_ROOT=$(docker inspect `hostname` | jq -r '.[0].Mounts | .[] | select(.Destination=="/home/jenkins") | .Source') + REAL_PWD=$(echo $PWD | sed "s|/home/jenkins|$DOCKER_VOLUME_ROOT|") + else + REAL_PWD=$PWD + fi + docker run --rm -v $REAL_PWD:/app -w /app python:3.10-slim-buster bash -c "pip install poetry && poetry build -f sdist && poetry publish -n -u __token__ -p $PYPI_TOKEN" + ''' + } + } + } +} \ No newline at end of file diff --git a/README.md b/README.md index 1b1f66a..eefc937 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,13 @@ youtube-dl supported services) channels, using Install package with requirements: -`pip install git+https://github.com/nbr23/ydl-podcast.git` +### Youtube-dl: + +`pip install ydl-podcast[youtube-dl]` + +### yt-dlp: + +`pip install ydl-podcast[yt-dlp]` ## Configuration diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..ea31bf4 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,35 @@ +[tool.poetry] +name = "ydl-podcast" +version = "1.0.0" +description = "A simple tool to generate Podcast-like RSS feeds from youtube (or other youtube-dl supported services) channels, using youtube-dl" +license = "MIT" +authors = ["nbr23 "] +homepage = "https://github.com/nbr23/ydl-podcast" +repository = "https://github.com/nbr23/ydl-podcast" +keywords = ["podcast", "youtube-dl"] +readme = "README.md" + +packages = [ + { include = "ydl_podcast" } +] + +[tool.poetry.scripts] +ydl-podcast = 'ydl_podcast.__main__:main' + +[tool.poetry.dependencies] +python = "^3.9" +youtube-dl = ">=2021.12.17" +PyYAML = "6.0" +Jinja2 = "^3.1.2" +MarkupSafe = "^2.1.1" +yt-dlp = { version = ">=2022.10.4", optional = true } + +[tool.poetry.dev-dependencies] + +[tool.poetry.extras] +yt-dlp = ["yt-dlp"] +youtube-dl = ["youtube-dl"] + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 783d63b..0000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -youtube_dl -Jinja2==3.1.2 -MarkupSafe==2.1.1 -PyYAML==6.0 \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 90c68ed..0000000 --- a/setup.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python3 - -from setuptools import setup - -setup(name='ydl_podcast', - version='1.0', - description='''A simple tool to generate Podcast-like RSS feeds from - youtube (or other youtube-dl supported services) channels, using - youtube-dl''', - author='nbr23', - author_email='max@23.tf', - url='https://github.com/nbr23/ydl-podcast', - license='MIT', - packages=['ydl_podcast'], - zip_safe=True, - install_requires=[ - 'youtube_dl', - 'pyyaml', - 'jinja2' - ], - entry_points={ - 'console_scripts': [ - "ydl-podcast = ydl_podcast.__main__:main", - ], - }, - )