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
59 description: yt-dlp_linux
63 description: yt-dlp_linux_aarch64, yt-dlp_linux_armv7l
67 description: yt-dlp_macos, yt-dlp_macos.zip
71 description: yt-dlp_macos_legacy
75 description: yt-dlp.exe, yt-dlp_min.exe, yt-dlp_win.zip
79 description: yt-dlp_x86.exe
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 - name: Install Requirements
117 sudo apt -y install zip pandoc man sed
120 python devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
121 python devscripts/update_changelog.py -vv
122 python devscripts/make_lazy_extractors.py
123 - name: Build Unix platform-independent binary
126 - name: Verify --update-to
127 if: vars.UPDATE_TO_VERIFICATION
130 cp ./yt-dlp ./yt-dlp_downgraded
131 version="$(./yt-dlp --version)"
132 ./yt-dlp_downgraded -v --update-to yt-dlp/yt-dlp@2023.03.04
133 downgraded_version="$(./yt-dlp_downgraded --version)"
134 [[ "$version" != "$downgraded_version" ]]
135 - name: Upload artifacts
136 uses: actions/upload-artifact@v4
138 name: build-bin-${{ github.job }}
146 if: inputs.linux_static
147 runs-on: ubuntu-latest
149 - uses: actions/checkout@v4
150 - name: Build static executable
152 channel: ${{ inputs.channel }}
153 origin: ${{ needs.process.outputs.origin }}
154 version: ${{ inputs.version }}
158 docker compose up --build static
159 sudo chown "${USER}:docker" ~/build/yt-dlp_linux
160 - name: Verify --update-to
161 if: vars.UPDATE_TO_VERIFICATION
163 chmod +x ~/build/yt-dlp_linux
164 cp ~/build/yt-dlp_linux ~/build/yt-dlp_linux_downgraded
165 version="$(~/build/yt-dlp_linux --version)"
166 ~/build/yt-dlp_linux_downgraded -v --update-to yt-dlp/yt-dlp@2023.03.04
167 downgraded_version="$(~/build/yt-dlp_linux_downgraded --version)"
168 [[ "$version" != "$downgraded_version" ]]
169 - name: Upload artifacts
170 uses: actions/upload-artifact@v4
172 name: build-bin-${{ github.job }}
182 packages: write # for creating cache
183 runs-on: ubuntu-latest
191 - uses: actions/checkout@v4
194 - name: Virtualized Install, Prepare & Build
195 uses: yt-dlp/run-on-arch-action@v2
197 # Ref: https://github.com/uraimo/run-on-arch-action/issues/55
199 GITHUB_WORKFLOW: build
200 githubToken: ${{ github.token }} # To cache image
201 arch: ${{ matrix.architecture }}
202 distro: ubuntu18.04 # Standalone executable should be built on minimum supported OS
203 dockerRunArgs: --volume "${PWD}/repo:/repo"
204 install: | # Installing Python 3.10 from the Deadsnakes repo raises errors
206 apt -y install zlib1g-dev libffi-dev python3.8 python3.8-dev python3.8-distutils python3-pip
207 python3.8 -m pip install -U pip setuptools wheel
208 # Cannot access any files from the repo directory at this stage
209 python3.8 -m pip install -U Pyinstaller mutagen pycryptodomex websockets brotli certifi secretstorage cffi
213 python3.8 devscripts/install_deps.py -o --include build
214 python3.8 devscripts/install_deps.py --include pyinstaller --include secretstorage # Cached version may be out of date
215 python3.8 devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
216 python3.8 devscripts/make_lazy_extractors.py
217 python3.8 -m bundle.pyinstaller
219 if ${{ vars.UPDATE_TO_VERIFICATION && 'true' || 'false' }}; then
220 arch="${{ (matrix.architecture == 'armv7' && 'armv7l') || matrix.architecture }}"
221 chmod +x ./dist/yt-dlp_linux_${arch}
222 cp ./dist/yt-dlp_linux_${arch} ./dist/yt-dlp_linux_${arch}_downgraded
223 version="$(./dist/yt-dlp_linux_${arch} --version)"
224 ./dist/yt-dlp_linux_${arch}_downgraded -v --update-to yt-dlp/yt-dlp@2023.03.04
225 downgraded_version="$(./dist/yt-dlp_linux_${arch}_downgraded --version)"
226 [[ "$version" != "$downgraded_version" ]]
229 - name: Upload artifacts
230 uses: actions/upload-artifact@v4
232 name: build-bin-linux_${{ matrix.architecture }}
233 path: | # run-on-arch-action designates armv7l as armv7
234 repo/dist/yt-dlp_linux_${{ (matrix.architecture == 'armv7' && 'armv7l') || matrix.architecture }}
243 - uses: actions/checkout@v4
244 # NB: Building universal2 does not work with python from actions/setup-python
245 - name: Install Requirements
247 brew install coreutils
248 python3 devscripts/install_deps.py --user -o --include build
249 python3 devscripts/install_deps.py --print --include pyinstaller > requirements.txt
250 # We need to ignore wheels otherwise we break universal2 builds
251 python3 -m pip install -U --user --no-binary :all: -r requirements.txt
252 # We need to fuse our own universal2 wheels for curl_cffi
253 python3 -m pip install -U --user delocate
254 mkdir curl_cffi_whls curl_cffi_universal2
255 python3 devscripts/install_deps.py --print -o --include curl-cffi > requirements.txt
256 for platform in "macosx_11_0_arm64" "macosx_11_0_x86_64"; do
257 python3 -m pip download \
258 --only-binary=:all: \
259 --platform "${platform}" \
260 --pre -d curl_cffi_whls \
263 python3 -m delocate.cmd.delocate_fuse curl_cffi_whls/curl_cffi*.whl -w curl_cffi_universal2
264 python3 -m delocate.cmd.delocate_fuse curl_cffi_whls/cffi*.whl -w curl_cffi_universal2
265 cd curl_cffi_universal2
266 for wheel in *cffi*.whl; do mv -n -- "${wheel}" "${wheel/x86_64/universal2}"; done
267 python3 -m pip install -U --user *cffi*.whl
271 python3 devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
272 python3 devscripts/make_lazy_extractors.py
275 python3 -m bundle.pyinstaller --target-architecture universal2 --onedir
276 (cd ./dist/yt-dlp_macos && zip -r ../yt-dlp_macos.zip .)
277 python3 -m bundle.pyinstaller --target-architecture universal2
279 - name: Verify --update-to
280 if: vars.UPDATE_TO_VERIFICATION
282 chmod +x ./dist/yt-dlp_macos
283 cp ./dist/yt-dlp_macos ./dist/yt-dlp_macos_downgraded
284 version="$(./dist/yt-dlp_macos --version)"
285 ./dist/yt-dlp_macos_downgraded -v --update-to yt-dlp/yt-dlp@2023.03.04
286 downgraded_version="$(./dist/yt-dlp_macos_downgraded --version)"
287 [[ "$version" != "$downgraded_version" ]]
289 - name: Upload artifacts
290 uses: actions/upload-artifact@v4
292 name: build-bin-${{ github.job }}
295 dist/yt-dlp_macos.zip
300 if: inputs.macos_legacy
304 - uses: actions/checkout@v4
305 - name: Install Python
306 # We need the official Python, because the GA ones only support newer macOS versions
308 PYTHON_VERSION: 3.10.5
309 MACOSX_DEPLOYMENT_TARGET: 10.9 # Used up by the Python build tools
311 # Hack to get the latest patch version. Uncomment if needed
312 #brew install python@3.10
313 #export PYTHON_VERSION=$( $(brew --prefix)/opt/python@3.10/bin/python3 --version | cut -d ' ' -f 2 )
314 curl https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-macos11.pkg -o "python.pkg"
315 sudo installer -pkg python.pkg -target /
317 - name: Install Requirements
319 brew install coreutils
320 python3 devscripts/install_deps.py --user -o --include build
321 python3 devscripts/install_deps.py --user --include pyinstaller
325 python3 devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
326 python3 devscripts/make_lazy_extractors.py
329 python3 -m bundle.pyinstaller
330 mv dist/yt-dlp_macos dist/yt-dlp_macos_legacy
332 - name: Verify --update-to
333 if: vars.UPDATE_TO_VERIFICATION
335 chmod +x ./dist/yt-dlp_macos_legacy
336 cp ./dist/yt-dlp_macos_legacy ./dist/yt-dlp_macos_legacy_downgraded
337 version="$(./dist/yt-dlp_macos_legacy --version)"
338 ./dist/yt-dlp_macos_legacy_downgraded -v --update-to yt-dlp/yt-dlp@2023.03.04
339 downgraded_version="$(./dist/yt-dlp_macos_legacy_downgraded --version)"
340 [[ "$version" != "$downgraded_version" ]]
342 - name: Upload artifacts
343 uses: actions/upload-artifact@v4
345 name: build-bin-${{ github.job }}
347 dist/yt-dlp_macos_legacy
353 runs-on: windows-latest
356 - uses: actions/checkout@v4
357 - uses: actions/setup-python@v5
358 with: # 3.8 is used for Win7 support
359 python-version: "3.8"
360 - name: Install Requirements
361 run: | # Custom pyinstaller built with https://github.com/yt-dlp/pyinstaller-builds
362 python devscripts/install_deps.py -o --include build
363 python devscripts/install_deps.py --include py2exe --include curl-cffi
364 python -m pip install -U "https://yt-dlp.github.io/Pyinstaller-Builds/x86_64/pyinstaller-5.8.0-py3-none-any.whl"
368 python devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
369 python devscripts/make_lazy_extractors.py
372 python -m bundle.py2exe
373 Move-Item ./dist/yt-dlp.exe ./dist/yt-dlp_min.exe
374 python -m bundle.pyinstaller
375 python -m bundle.pyinstaller --onedir
376 Compress-Archive -Path ./dist/yt-dlp/* -DestinationPath ./dist/yt-dlp_win.zip
378 - name: Verify --update-to
379 if: vars.UPDATE_TO_VERIFICATION
381 foreach ($name in @("yt-dlp","yt-dlp_min")) {
382 Copy-Item "./dist/${name}.exe" "./dist/${name}_downgraded.exe"
383 $version = & "./dist/${name}.exe" --version
384 & "./dist/${name}_downgraded.exe" -v --update-to yt-dlp/yt-dlp@2023.03.04
385 $downgraded_version = & "./dist/${name}_downgraded.exe" --version
386 if ($version -eq $downgraded_version) {
391 - name: Upload artifacts
392 uses: actions/upload-artifact@v4
394 name: build-bin-${{ github.job }}
404 runs-on: windows-latest
407 - uses: actions/checkout@v4
408 - uses: actions/setup-python@v5
410 python-version: "3.8"
412 - name: Install Requirements
414 python devscripts/install_deps.py -o --include build
415 python devscripts/install_deps.py
416 python -m pip install -U "https://yt-dlp.github.io/Pyinstaller-Builds/i686/pyinstaller-5.8.0-py3-none-any.whl"
420 python devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
421 python devscripts/make_lazy_extractors.py
424 python -m bundle.pyinstaller
426 - name: Verify --update-to
427 if: vars.UPDATE_TO_VERIFICATION
429 foreach ($name in @("yt-dlp_x86")) {
430 Copy-Item "./dist/${name}.exe" "./dist/${name}_downgraded.exe"
431 $version = & "./dist/${name}.exe" --version
432 & "./dist/${name}_downgraded.exe" -v --update-to yt-dlp/yt-dlp@2023.03.04
433 $downgraded_version = & "./dist/${name}_downgraded.exe" --version
434 if ($version -eq $downgraded_version) {
439 - name: Upload artifacts
440 uses: actions/upload-artifact@v4
442 name: build-bin-${{ github.job }}
448 if: always() && !cancelled()
458 runs-on: ubuntu-latest
460 - uses: actions/download-artifact@v4
466 - name: Make SHA2-SUMS files
469 # make sure SHA sums are also printed to stdout
470 sha256sum * | tee ../SHA2-256SUMS
471 sha512sum * | tee ../SHA2-512SUMS
473 - name: Make Update spec
475 cat >> _update_spec << EOF
476 # This file is used for regulating self-update
477 lock 2022.08.18.36 .+ Python 3\.6
478 lock 2023.11.16 (?!win_x86_exe).+ Python 3\.7
479 lock 2023.11.16 win_x86_exe .+ Windows-(?:Vista|2008Server)
480 lockV2 yt-dlp/yt-dlp 2022.08.18.36 .+ Python 3\.6
481 lockV2 yt-dlp/yt-dlp 2023.11.16 (?!win_x86_exe).+ Python 3\.7
482 lockV2 yt-dlp/yt-dlp 2023.11.16 win_x86_exe .+ Windows-(?:Vista|2008Server)
483 lockV2 yt-dlp/yt-dlp-nightly-builds 2023.11.15.232826 (?!win_x86_exe).+ Python 3\.7
484 lockV2 yt-dlp/yt-dlp-nightly-builds 2023.11.15.232826 win_x86_exe .+ Windows-(?:Vista|2008Server)
485 lockV2 yt-dlp/yt-dlp-master-builds 2023.11.15.232812 (?!win_x86_exe).+ Python 3\.7
486 lockV2 yt-dlp/yt-dlp-master-builds 2023.11.15.232812 win_x86_exe .+ Windows-(?:Vista|2008Server)
489 - name: Sign checksum files
491 GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
492 if: env.GPG_SIGNING_KEY != ''
494 gpg --batch --import <<< "${{ secrets.GPG_SIGNING_KEY }}"
495 for signfile in ./SHA*SUMS; do
496 gpg --batch --detach-sign "$signfile"
499 - name: Upload artifacts
500 uses: actions/upload-artifact@v4
502 name: build-${{ github.job }}