45 VERSION: yyyy.mm.dd[.rev] or rev
50 SOURCE of this build's updates: stable/nightly/master/<repo>
55 description: yt-dlp, yt-dlp.tar.gz, yt-dlp_linux, yt-dlp_linux.zip
59 description: yt-dlp_linux_aarch64, yt-dlp_linux_armv7l
63 description: yt-dlp_macos, yt-dlp_macos.zip
67 description: yt-dlp_macos_legacy
71 description: yt-dlp.exe, yt-dlp_min.exe, yt-dlp_win.zip
75 description: yt-dlp_x86.exe
79 description: SHA2-256SUMS, SHA2-512SUMS, _update_spec
85 default: 'current repo'
95 runs-on: ubuntu-latest
97 origin: ${{ steps.process_origin.outputs.origin }}
99 - name: Process origin
102 echo "origin=${{ inputs.origin == 'current repo' && github.repository || inputs.origin }}" | tee "$GITHUB_OUTPUT"
107 runs-on: ubuntu-latest
109 - uses: actions/checkout@v4
111 fetch-depth: 0 # Needed for changelog
112 - uses: actions/setup-python@v5
114 python-version: "3.10"
115 - uses: conda-incubator/setup-miniconda@v3
117 miniforge-variant: Mambaforge
119 channels: conda-forge
120 auto-update-conda: true
121 activate-environment: ""
122 auto-activate-base: false
123 - name: Install Requirements
125 sudo apt -y install zip pandoc man sed
126 cat > ./requirements.txt << EOF
131 python devscripts/install_deps.py --print \
132 --exclude brotli --exclude brotlicffi \
133 --include secretstorage >> ./requirements.txt
134 mamba create -n build --file ./requirements.txt
138 python devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
139 python devscripts/update_changelog.py -vv
140 python devscripts/make_lazy_extractors.py
141 - name: Build Unix platform-independent binary
144 - name: Build Unix standalone binary
147 unset LD_LIBRARY_PATH # Harmful; set by setup-python
149 python -m bundle.pyinstaller --onedir
150 (cd ./dist/yt-dlp_linux && zip -r ../yt-dlp_linux.zip .)
151 python -m bundle.pyinstaller
152 mv ./dist/yt-dlp_linux ./yt-dlp_linux
153 mv ./dist/yt-dlp_linux.zip ./yt-dlp_linux.zip
155 - name: Verify --update-to
156 if: vars.UPDATE_TO_VERIFICATION
158 binaries=("yt-dlp" "yt-dlp_linux")
159 for binary in "${binaries[@]}"; do
161 cp ./${binary} ./${binary}_downgraded
162 version="$(./${binary} --version)"
163 ./${binary}_downgraded -v --update-to yt-dlp/yt-dlp@2023.03.04
164 downgraded_version="$(./${binary}_downgraded --version)"
165 [[ "$version" != "$downgraded_version" ]]
168 - name: Upload artifacts
169 uses: actions/upload-artifact@v4
171 name: build-bin-${{ github.job }}
184 packages: write # for creating cache
185 runs-on: ubuntu-latest
193 - uses: actions/checkout@v4
196 - name: Virtualized Install, Prepare & Build
197 uses: yt-dlp/run-on-arch-action@v2
199 # Ref: https://github.com/uraimo/run-on-arch-action/issues/55
201 GITHUB_WORKFLOW: build
202 githubToken: ${{ github.token }} # To cache image
203 arch: ${{ matrix.architecture }}
204 distro: ubuntu18.04 # Standalone executable should be built on minimum supported OS
205 dockerRunArgs: --volume "${PWD}/repo:/repo"
206 install: | # Installing Python 3.10 from the Deadsnakes repo raises errors
208 apt -y install zlib1g-dev libffi-dev python3.8 python3.8-dev python3.8-distutils python3-pip
209 python3.8 -m pip install -U pip setuptools wheel
210 # Cannot access any files from the repo directory at this stage
211 python3.8 -m pip install -U Pyinstaller mutagen pycryptodomex websockets brotli certifi secretstorage cffi
215 python3.8 devscripts/install_deps.py -o --include build
216 python3.8 devscripts/install_deps.py --include pyinstaller --include secretstorage # Cached version may be out of date
217 python3.8 devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
218 python3.8 devscripts/make_lazy_extractors.py
219 python3.8 -m bundle.pyinstaller
221 if ${{ vars.UPDATE_TO_VERIFICATION && 'true' || 'false' }}; then
222 arch="${{ (matrix.architecture == 'armv7' && 'armv7l') || matrix.architecture }}"
223 chmod +x ./dist/yt-dlp_linux_${arch}
224 cp ./dist/yt-dlp_linux_${arch} ./dist/yt-dlp_linux_${arch}_downgraded
225 version="$(./dist/yt-dlp_linux_${arch} --version)"
226 ./dist/yt-dlp_linux_${arch}_downgraded -v --update-to yt-dlp/yt-dlp@2023.03.04
227 downgraded_version="$(./dist/yt-dlp_linux_${arch}_downgraded --version)"
228 [[ "$version" != "$downgraded_version" ]]
231 - name: Upload artifacts
232 uses: actions/upload-artifact@v4
234 name: build-bin-linux_${{ matrix.architecture }}
235 path: | # run-on-arch-action designates armv7l as armv7
236 repo/dist/yt-dlp_linux_${{ (matrix.architecture == 'armv7' && 'armv7l') || matrix.architecture }}
245 - uses: actions/checkout@v4
246 # NB: Building universal2 does not work with python from actions/setup-python
247 - name: Install Requirements
249 brew install coreutils
250 python3 devscripts/install_deps.py --user -o --include build
251 python3 devscripts/install_deps.py --print --include pyinstaller > requirements.txt
252 # We need to ignore wheels otherwise we break universal2 builds
253 python3 -m pip install -U --user --no-binary :all: -r requirements.txt
254 # We need to fuse our own universal2 wheels for curl_cffi
255 python3 -m pip install -U --user delocate
256 mkdir curl_cffi_whls curl_cffi_universal2
257 python3 devscripts/install_deps.py --print -o --include curl_cffi > requirements.txt
258 for platform in "macosx_11_0_arm64" "macosx_11_0_x86_64"; do
259 python3 -m pip download \
260 --only-binary=:all: \
261 --platform "${platform}" \
262 --pre -d curl_cffi_whls \
265 python3 -m delocate.cmd.delocate_fuse curl_cffi_whls/curl_cffi*.whl -w curl_cffi_universal2
266 python3 -m delocate.cmd.delocate_fuse curl_cffi_whls/cffi*.whl -w curl_cffi_universal2
267 cd curl_cffi_universal2
268 for wheel in *cffi*.whl; do mv -n -- "${wheel}" "${wheel/x86_64/universal2}"; done
269 python3 -m pip install -U --user *cffi*.whl
273 python3 devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
274 python3 devscripts/make_lazy_extractors.py
277 python3 -m bundle.pyinstaller --target-architecture universal2 --onedir
278 (cd ./dist/yt-dlp_macos && zip -r ../yt-dlp_macos.zip .)
279 python3 -m bundle.pyinstaller --target-architecture universal2
281 - name: Verify --update-to
282 if: vars.UPDATE_TO_VERIFICATION
284 chmod +x ./dist/yt-dlp_macos
285 cp ./dist/yt-dlp_macos ./dist/yt-dlp_macos_downgraded
286 version="$(./dist/yt-dlp_macos --version)"
287 ./dist/yt-dlp_macos_downgraded -v --update-to yt-dlp/yt-dlp@2023.03.04
288 downgraded_version="$(./dist/yt-dlp_macos_downgraded --version)"
289 [[ "$version" != "$downgraded_version" ]]
291 - name: Upload artifacts
292 uses: actions/upload-artifact@v4
294 name: build-bin-${{ github.job }}
297 dist/yt-dlp_macos.zip
302 if: inputs.macos_legacy
303 runs-on: macos-latest
306 - uses: actions/checkout@v4
307 - name: Install Python
308 # We need the official Python, because the GA ones only support newer macOS versions
310 PYTHON_VERSION: 3.10.5
311 MACOSX_DEPLOYMENT_TARGET: 10.9 # Used up by the Python build tools
313 # Hack to get the latest patch version. Uncomment if needed
314 #brew install python@3.10
315 #export PYTHON_VERSION=$( $(brew --prefix)/opt/python@3.10/bin/python3 --version | cut -d ' ' -f 2 )
316 curl https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-macos11.pkg -o "python.pkg"
317 sudo installer -pkg python.pkg -target /
319 - name: Install Requirements
321 brew install coreutils
322 python3 devscripts/install_deps.py --user -o --include build
323 python3 devscripts/install_deps.py --user --include pyinstaller
327 python3 devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
328 python3 devscripts/make_lazy_extractors.py
331 python3 -m bundle.pyinstaller
332 mv dist/yt-dlp_macos dist/yt-dlp_macos_legacy
334 - name: Verify --update-to
335 if: vars.UPDATE_TO_VERIFICATION
337 chmod +x ./dist/yt-dlp_macos_legacy
338 cp ./dist/yt-dlp_macos_legacy ./dist/yt-dlp_macos_legacy_downgraded
339 version="$(./dist/yt-dlp_macos_legacy --version)"
340 ./dist/yt-dlp_macos_legacy_downgraded -v --update-to yt-dlp/yt-dlp@2023.03.04
341 downgraded_version="$(./dist/yt-dlp_macos_legacy_downgraded --version)"
342 [[ "$version" != "$downgraded_version" ]]
344 - name: Upload artifacts
345 uses: actions/upload-artifact@v4
347 name: build-bin-${{ github.job }}
349 dist/yt-dlp_macos_legacy
355 runs-on: windows-latest
358 - uses: actions/checkout@v4
359 - uses: actions/setup-python@v5
360 with: # 3.8 is used for Win7 support
361 python-version: "3.8"
362 - name: Install Requirements
363 run: | # Custom pyinstaller built with https://github.com/yt-dlp/pyinstaller-builds
364 python devscripts/install_deps.py -o --include build
365 python devscripts/install_deps.py --include py2exe --include curl_cffi
366 python -m pip install -U "https://yt-dlp.github.io/Pyinstaller-Builds/x86_64/pyinstaller-5.8.0-py3-none-any.whl"
370 python devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
371 python devscripts/make_lazy_extractors.py
374 python -m bundle.py2exe
375 Move-Item ./dist/yt-dlp.exe ./dist/yt-dlp_min.exe
376 python -m bundle.pyinstaller
377 python -m bundle.pyinstaller --onedir
378 Compress-Archive -Path ./dist/yt-dlp/* -DestinationPath ./dist/yt-dlp_win.zip
380 - name: Verify --update-to
381 if: vars.UPDATE_TO_VERIFICATION
383 foreach ($name in @("yt-dlp","yt-dlp_min")) {
384 Copy-Item "./dist/${name}.exe" "./dist/${name}_downgraded.exe"
385 $version = & "./dist/${name}.exe" --version
386 & "./dist/${name}_downgraded.exe" -v --update-to yt-dlp/yt-dlp@2023.03.04
387 $downgraded_version = & "./dist/${name}_downgraded.exe" --version
388 if ($version -eq $downgraded_version) {
393 - name: Upload artifacts
394 uses: actions/upload-artifact@v4
396 name: build-bin-${{ github.job }}
406 runs-on: windows-latest
409 - uses: actions/checkout@v4
410 - uses: actions/setup-python@v5
412 python-version: "3.8"
414 - name: Install Requirements
416 python devscripts/install_deps.py -o --include build
417 python devscripts/install_deps.py
418 python -m pip install -U "https://yt-dlp.github.io/Pyinstaller-Builds/i686/pyinstaller-5.8.0-py3-none-any.whl"
422 python devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
423 python devscripts/make_lazy_extractors.py
426 python -m bundle.pyinstaller
428 - name: Verify --update-to
429 if: vars.UPDATE_TO_VERIFICATION
431 foreach ($name in @("yt-dlp_x86")) {
432 Copy-Item "./dist/${name}.exe" "./dist/${name}_downgraded.exe"
433 $version = & "./dist/${name}.exe" --version
434 & "./dist/${name}_downgraded.exe" -v --update-to yt-dlp/yt-dlp@2023.03.04
435 $downgraded_version = & "./dist/${name}_downgraded.exe" --version
436 if ($version -eq $downgraded_version) {
441 - name: Upload artifacts
442 uses: actions/upload-artifact@v4
444 name: build-bin-${{ github.job }}
450 if: inputs.meta_files && always() && !cancelled()
459 runs-on: ubuntu-latest
461 - uses: actions/download-artifact@v4
467 - name: Make SHA2-SUMS files
470 # make sure SHA sums are also printed to stdout
471 sha256sum * | tee ../SHA2-256SUMS
472 sha512sum * | tee ../SHA2-512SUMS
474 - name: Make Update spec
476 cat >> _update_spec << EOF
477 # This file is used for regulating self-update
478 lock 2022.08.18.36 .+ Python 3\.6
479 lock 2023.11.16 (?!win_x86_exe).+ Python 3\.7
480 lock 2023.11.16 win_x86_exe .+ Windows-(?:Vista|2008Server)
481 lockV2 yt-dlp/yt-dlp 2022.08.18.36 .+ Python 3\.6
482 lockV2 yt-dlp/yt-dlp 2023.11.16 (?!win_x86_exe).+ Python 3\.7
483 lockV2 yt-dlp/yt-dlp 2023.11.16 win_x86_exe .+ Windows-(?:Vista|2008Server)
484 lockV2 yt-dlp/yt-dlp-nightly-builds 2023.11.15.232826 (?!win_x86_exe).+ Python 3\.7
485 lockV2 yt-dlp/yt-dlp-nightly-builds 2023.11.15.232826 win_x86_exe .+ Windows-(?:Vista|2008Server)
486 lockV2 yt-dlp/yt-dlp-master-builds 2023.11.15.232812 (?!win_x86_exe).+ Python 3\.7
487 lockV2 yt-dlp/yt-dlp-master-builds 2023.11.15.232812 win_x86_exe .+ Windows-(?:Vista|2008Server)
490 - name: Sign checksum files
492 GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
493 if: env.GPG_SIGNING_KEY != ''
495 gpg --batch --import <<< "${{ secrets.GPG_SIGNING_KEY }}"
496 for signfile in ./SHA*SUMS; do
497 gpg --batch --detach-sign "$signfile"
500 - name: Upload artifacts
501 uses: actions/upload-artifact@v4
503 name: build-${{ github.job }}