From e4afcfde08cbd40147e75c924768f1598ece1885 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Sun, 22 May 2022 01:19:49 +0530 Subject: [PATCH] [build] Add Linux standalone builds --- .github/workflows/build.yml | 39 +++++++++++++++++++++++++++++++++---- README.md | 2 ++ pyinst.py | 2 +- yt_dlp/update.py | 3 ++- 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 687f67b34..5d3473343 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -70,14 +70,16 @@ jobs: build_unix: needs: create_release - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 # Standalone executable should be built on minimum supported OS outputs: sha256_bin: ${{ steps.get_sha.outputs.sha256_bin }} sha512_bin: ${{ steps.get_sha.outputs.sha512_bin }} sha256_tar: ${{ steps.get_sha.outputs.sha256_tar }} sha512_tar: ${{ steps.get_sha.outputs.sha512_tar }} - sha256_unix_zip: ${{ steps.get_sha.outputs.sha256_unix_zip }} - sha512_unix_zip: ${{ steps.get_sha.outputs.sha512_unix_zip }} + sha256_linux: ${{ steps.get_sha.outputs.sha256_linux }} + sha512_linux: ${{ steps.get_sha.outputs.sha512_linux }} + sha256_linux_zip: ${{ steps.get_sha.outputs.sha256_linux_zip }} + sha512_linux_zip: ${{ steps.get_sha.outputs.sha512_linux_zip }} steps: - uses: actions/checkout@v2 @@ -94,9 +96,12 @@ jobs: run: | python devscripts/update-version.py ${{ needs.create_release.outputs.version_suffix }} python devscripts/make_lazy_extractors.py - - name: Build UNIX executables + - name: Build Unix executables run: | make all tar + python pyinst.py --onedir + (cd ./dist/yt-dlp_linux && zip -r ../yt-dlp_linux.zip .) + python pyinst.py - name: Get SHA2-SUMS id: get_sha run: | @@ -104,6 +109,10 @@ jobs: echo "::set-output name=sha512_bin::$(sha512sum yt-dlp | awk '{print $1}')" echo "::set-output name=sha256_tar::$(sha256sum yt-dlp.tar.gz | awk '{print $1}')" echo "::set-output name=sha512_tar::$(sha512sum yt-dlp.tar.gz | awk '{print $1}')" + echo "::set-output name=sha256_linux::$(sha256sum dist/yt-dlp_linux | awk '{print $1}')" + echo "::set-output name=sha512_linux::$(sha512sum dist/yt-dlp_linux | awk '{print $1}')" + echo "::set-output name=sha256_linux_zip::$(sha256sum dist/yt-dlp_linux.zip | awk '{print $1}')" + echo "::set-output name=sha512_linux_zip::$(sha512sum dist/yt-dlp_linux.zip | awk '{print $1}')" - name: Upload zip binary uses: actions/upload-release-asset@v1 @@ -123,6 +132,24 @@ jobs: asset_path: ./yt-dlp.tar.gz asset_name: yt-dlp.tar.gz asset_content_type: application/gzip + - name: Upload standalone binary + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ./dist/yt-dlp_linux + asset_name: yt-dlp_linux + asset_content_type: application/octet-stream + - name: Upload onedir binary + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create_release.outputs.upload_url }} + asset_path: ./dist/yt-dlp_linux.zip + asset_name: yt-dlp_linux.zip + asset_content_type: application/zip - name: Build and publish on PyPi env: @@ -330,6 +357,8 @@ jobs: run: | echo "${{ needs.build_unix.outputs.sha256_bin }} yt-dlp" >> SHA2-256SUMS echo "${{ needs.build_unix.outputs.sha256_tar }} yt-dlp.tar.gz" >> SHA2-256SUMS + echo "${{ needs.build_unix.outputs.sha256_linux }} yt-dlp_linux" >> SHA2-256SUMS + echo "${{ needs.build_unix.outputs.sha256_linux_zip }} yt-dlp_linux.zip" >> SHA2-256SUMS echo "${{ needs.build_windows.outputs.sha256_win }} yt-dlp.exe" >> SHA2-256SUMS echo "${{ needs.build_windows.outputs.sha256_py2exe }} yt-dlp_min.exe" >> SHA2-256SUMS echo "${{ needs.build_windows32.outputs.sha256_win32 }} yt-dlp_x86.exe" >> SHA2-256SUMS @@ -338,6 +367,8 @@ jobs: echo "${{ needs.build_macos.outputs.sha256_macos_zip }} yt-dlp_macos.zip" >> SHA2-256SUMS echo "${{ needs.build_unix.outputs.sha512_bin }} yt-dlp" >> SHA2-512SUMS echo "${{ needs.build_unix.outputs.sha512_tar }} yt-dlp.tar.gz" >> SHA2-512SUMS + echo "${{ needs.build_unix.outputs.sha512_linux }} yt-dlp_linux" >> SHA2-512SUMS + echo "${{ needs.build_unix.outputs.sha512_linux_zip }} yt-dlp_linux.zip" >> SHA2-512SUMS echo "${{ needs.build_windows.outputs.sha512_win }} yt-dlp.exe" >> SHA2-512SUMS echo "${{ needs.build_windows.outputs.sha512_py2exe }} yt-dlp_min.exe" >> SHA2-512SUMS echo "${{ needs.build_windows32.outputs.sha512_win32 }} yt-dlp_x86.exe" >> SHA2-512SUMS diff --git a/README.md b/README.md index 62979ff09..3261f88c7 100644 --- a/README.md +++ b/README.md @@ -248,6 +248,8 @@ File|Description :---|:--- [yt-dlp_x86.exe](https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_x86.exe)|Windows (Vista SP2+) standalone x86 (32-bit) binary [yt-dlp_min.exe](https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_min.exe)|Windows (Win7 SP1+) standalone x64 binary built with `py2exe`
([Not recommended](#standalone-py2exe-builds-windows)) +[yt-dlp_linux](https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux)|UNIX standalone x64 binary +[yt-dlp_linux.zip](https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux.zip)|Unpackaged Unix executable (no auto-update) [yt-dlp_win.zip](https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_win.zip)|Unpackaged Windows executable (no auto-update) [yt-dlp_macos.zip](https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_macos.zip)|Unpackaged MacOS (10.15+) executable (no auto-update) diff --git a/pyinst.py b/pyinst.py index d27e56555..4401125ed 100644 --- a/pyinst.py +++ b/pyinst.py @@ -63,7 +63,7 @@ def exe(onedir): """@returns (name, path)""" name = '_'.join(filter(None, ( 'yt-dlp', - OS_NAME == 'darwin' and 'macos', + {'win32': '', 'darwin': 'macos'}.get(OS_NAME, OS_NAME), ARCH == '32' and 'x86' ))) return name, ''.join(filter(None, ( diff --git a/yt_dlp/update.py b/yt_dlp/update.py index f4ce4f958..8e34f2127 100644 --- a/yt_dlp/update.py +++ b/yt_dlp/update.py @@ -45,12 +45,13 @@ _FILE_SUFFIXES = { 'py2exe': '_min.exe', 'win32_exe': '.exe', 'darwin_exe': '_macos', + 'linux_exe': '_linux', } _NON_UPDATEABLE_REASONS = { **{variant: None for variant in _FILE_SUFFIXES}, # Updatable **{variant: f'Auto-update is not supported for unpackaged {name} executable; Re-download the latest release' - for variant, name in {'win32_dir': 'Windows', 'darwin_dir': 'MacOS'}.items()}, + for variant, name in {'win32_dir': 'Windows', 'darwin_dir': 'MacOS', 'linux_dir': 'Linux'}.items()}, 'source': 'You cannot update when running from source code; Use git to pull the latest changes', 'unknown': 'It looks like you installed yt-dlp with a package manager, pip or setup.py; Use that to update', 'other': 'It looks like you are using an unofficial build of yt-dlp; Build the executable again',