-
Notifications
You must be signed in to change notification settings - Fork 15
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
- 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
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)
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.
note: yt-dlp/yt-dlp#11255 has been merged
@@ -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?
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
If there are issues with the default behaviour of bundling deps in the release zip, we could perhaps disable it by default? Developers can enable it if they would like? |
Co-authored-by: N/Ame <[email protected]>
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.8" |
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 should be 3.9(yt-dlp/yt-dlp#11321)
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