-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add release workflow #3
base: master
Are you sure you want to change the base?
Conversation
version = "2023.01.02" | ||
readme = "README.md" | ||
requires-python = ">=3.8" | ||
license = "MIT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
license = "MIT" | |
license = "Unlicense" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a discrepancy between wanting people to NOT use Unlicense by default, and us licensing the code as Unlicense... But I'll make it Unlicense for the time being
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
license = "MIT" | |
license = {file = "LICENSE"} |
why not let the plugin developer decide which license to use theirself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair
@@ -1,4 +1,4 @@ | |||
This repository contains a sample plugin package for [yt-dlp](https://github.com/yt-dlp/yt-dlp#readme). | |||
This repository contains a sample plugin package for [yt-dlp](https://github.com/yt-dlp/yt-dlp#readme). | |||
|
|||
See [yt-dlp plugins](https://github.com/yt-dlp/yt-dlp#plugins) for more details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should expand on the installation instructions
Perhaps something like
1. Download the latest release zip from [releases](https://github.com/yt-dlp/yt-dlp-sample-plugins/releases)
2. Add the zip to one of the [yt-dlp plugin locations](https://github.com/yt-dlp/yt-dlp#installing-plugins)
- User Plugins
- `${XDG_CONFIG_HOME}/yt-dlp/plugins` (recommended on Linux/MacOS)
- `~/.yt-dlp/plugins/`
- `${APPDATA}/yt-dlp/plugins/` (recommended on Windows)
- System Plugins
- `/etc/yt-dlp/plugins/`
- `/etc/yt-dlp-plugins/`
- Executable location
- Binary: where `<root-dir>/yt-dlp.exe`, `<root-dir>/yt-dlp-plugins/`
For more locations and methods, see [installing yt-dlp plugins](https://github.com/yt-dlp/yt-dlp#installing-plugins)
- name: Set variables | ||
id: set_variables | ||
run: | | ||
tag="$(git describe --tags --abbrev=0)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to assume a git tag already exists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right I forgot I tested with a failed tag existing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tag="$(git describe --tags --abbrev=0)" | |
tag=$(git for-each-ref refs/tags --sort=-creatordate --format='%(refname:strip=2)' --count=1) |
This gives an empty string when no tags are present. It works without problem creating the first release of the repo.
Refer to https://stackoverflow.com/a/5261470
name: Create release | ||
on: [push] | ||
|
||
jobs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps could be useful to add pypi publishing too (might be out of scope for this pr)
|
||
import_path = str(pathlib.Path(__file__).parent.parent.parent) | ||
|
||
sys.path.insert(0, import_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong:
sys.path.insert(0, import_path) | |
sys.path.append(import_path) |
while IFS=';' read -r name path; do | ||
if [[ ! "${name}" =~ ^(pip|setuptools|wheel)$ ]]; then | ||
package_name="$(tr '[:upper:]' '[:lower:]' <<<"${name}" | sed 's/-/_/g')" | ||
cp -r "${path}/${package_name}" bundle/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some projects don't have it's code in this path. For example a normal yt-dlp plugin or yt-dlp itself. not sure if we can run pip install .
and change installation path to bundle/
and remove .dist-info
if necessary, probably like pip install -t bundle/ .
?
example log from shell
$ pip install -t bundle/ .; ls -al bundle/
Processing /home/user/tmp
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting yt-dlp-get-pot>=0.0.2
Using cached yt_dlp_get_pot-0.0.2-py3-none-any.whl (6.8 kB)
Building wheels for collected packages: definitely_not_bgutil-ytdlp-pot-provider_to_distinguish_from_it
Building wheel for definitely_not_bgutil-ytdlp-pot-provider_to_distinguish_from_it (pyproject.toml) ... done
Created wheel for definitely_not_bgutil-ytdlp-pot-provider_to_distinguish_from_it: filename=definitely_not_bgutil_ytdlp_pot_provider_to_distinguish_from_it-0.2.22-py3-none-any.whl size=1243 sha256=25788b6ccab2676493a4fdb39808dc3833a7699963d504e1137f2d2fde310794
Stored in directory: /tmp/pip-ephem-wheel-cache-yh0ca0qt/wheels/c5/5b/dd/eba17e133d5a684b348375bea715fd011a6e07e4630222c11b
Successfully built definitely_not_bgutil-ytdlp-pot-provider_to_distinguish_from_it
Installing collected packages: yt-dlp-get-pot, definitely_not_bgutil-ytdlp-pot-provider_to_distinguish_from_it
Successfully installed definitely_not_bgutil-ytdlp-pot-provider_to_distinguish_from_it-0.2.22 yt-dlp-get-pot-0.0.2
total 20
drwxr-xr-x 5 user user 4096 Sep 2 19:42 .
drwxr-xr-x 5 user user 4096 Sep 2 19:42 ..
drwxr-xr-x 2 user user 4096 Sep 2 19:42 definitely_not_bgutil_ytdlp_pot_provider_to_distinguish_from_it-0.2.22.dist-info
drwxr-xr-x 3 user user 4096 Sep 2 19:42 yt_dlp_get_pot-0.0.2.dist-info
drwxr-xr-x 3 user user 4096 Sep 2 19:42 yt_dlp_plugins
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will look into it; it's def cleaner than copying.
Perhaps we could use something like hatch dep show requirements
, or something with --no-deps
? There's room to cook something here, I just can't see it quite yet
cp -r yt_dlp_plugins bundle/ | ||
|
||
while IFS=';' read -r name path; do | ||
if [[ ! "${name}" =~ ^(pip|setuptools|wheel)$ ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably also exclude yt-dlp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggested this originally too, but found you'd need to specify all of yt-dlp's dependencies too (until yt-dlp switches to not requiring deps by default)
@@ -0,0 +1,65 @@ | |||
name: Create release | |||
on: [push] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on: [push] | |
on: | |
push: | |
branches: | |
- 'master' | |
paths: | |
- 'pyproject.toml' |
maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dislike having the branch hardcoded, as I tend to use main
for my branches, but I guess if people use the template they will get this name...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if: format('refs/heads/{0}', github.event.repository.default_branch) == github.ref
maybe use this at job level instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That'll make it show up as a run but just be skipped. Your previous suggestion is the way to go I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use something like this?
branches:
- ${{ github.event.repository.default_branch }}
if: | | ||
env.tag != env.version | ||
run: | | ||
project_name="$(hatch project metadata | jq -r .name)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move this to the set_variables
step?
gh release create "${version}" --latest \ | ||
--title "${project_name} ${version}" \ | ||
"${project_name}.zip" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider generating a simple changelog
run: | | ||
tag="$(git describe --tags --abbrev=0)" | ||
echo "::group::Variables" | ||
cat << EOF | tee -a "$GITHUB_OUTPUT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe $GITHUB_ENV
is more appropriate here if we are not using these values in other jobs
see: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#setting-an-environment-variable
Following changes:
Upon merge this will create a dummy release if actions are activated. The same goes for when creating a repository with this as template, and actions enabled. Is this a problem?
Demo release: https://github.com/Grub4K/yt-dlp-sample-plugins/releases/tag/v2023.1.2
Fixes #2