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
110 - uses: actions/setup-python@v5
112 python-version: "3.10"
113 - uses: conda-incubator/setup-miniconda@v3
115 miniforge-variant: Mambaforge
117 channels: conda-forge
118 auto-update-conda: true
119 activate-environment: ""
120 auto-activate-base: false
121 - name: Install Requirements
123 sudo apt -y install zip pandoc man sed
124 cat > ./requirements.txt << EOF
128 python devscripts/install_deps.py --print \
129 --exclude brotli --exclude brotlicffi \
130 --include secretstorage --include pyinstaller >> ./requirements.txt
131 mamba create -n build --file ./requirements.txt
135 python devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
136 python devscripts/make_lazy_extractors.py
137 - name: Build Unix platform-independent binary
140 - name: Build Unix standalone binary
143 unset LD_LIBRARY_PATH # Harmful; set by setup-python
145 python -m bundle.pyinstaller --onedir
146 (cd ./dist/yt-dlp_linux && zip -r ../yt-dlp_linux.zip .)
147 python -m bundle.pyinstaller
148 mv ./dist/yt-dlp_linux ./yt-dlp_linux
149 mv ./dist/yt-dlp_linux.zip ./yt-dlp_linux.zip
151 - name: Verify --update-to
152 if: vars.UPDATE_TO_VERIFICATION
154 binaries=("yt-dlp" "yt-dlp_linux")
155 for binary in "${binaries[@]}"; do
157 cp ./${binary} ./${binary}_downgraded
158 version="$(./${binary} --version)"
159 ./${binary}_downgraded -v --update-to yt-dlp/yt-dlp@2023.03.04
160 downgraded_version="$(./${binary}_downgraded --version)"
161 [[ "$version" != "$downgraded_version" ]]
164 - name: Upload artifacts
165 uses: actions/upload-artifact@v4
167 name: build-${{ github.job }}
180 packages: write # for creating cache
181 runs-on: ubuntu-latest
189 - uses: actions/checkout@v4
192 - name: Virtualized Install, Prepare & Build
193 uses: yt-dlp/run-on-arch-action@v2
195 # Ref: https://github.com/uraimo/run-on-arch-action/issues/55
197 GITHUB_WORKFLOW: build
198 githubToken: ${{ github.token }} # To cache image
199 arch: ${{ matrix.architecture }}
200 distro: ubuntu18.04 # Standalone executable should be built on minimum supported OS
201 dockerRunArgs: --volume "${PWD}/repo:/repo"
202 install: | # Installing Python 3.10 from the Deadsnakes repo raises errors
204 apt -y install zlib1g-dev libffi-dev python3.8 python3.8-dev python3.8-distutils python3-pip
205 python3.8 -m pip install -U pip setuptools wheel
206 # Cannot access any files from the repo directory at this stage
207 python3.8 -m pip install -U Pyinstaller mutagen pycryptodomex websockets brotli certifi secretstorage cffi
211 python3.8 devscripts/install_deps.py -o --include build
212 python3.8 devscripts/install_deps.py --include pyinstaller --include secretstorage # Cached version may be out of date
213 python3.8 devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
214 python3.8 devscripts/make_lazy_extractors.py
215 python3.8 -m bundle.pyinstaller
217 if ${{ vars.UPDATE_TO_VERIFICATION && 'true' || 'false' }}; then
218 arch="${{ (matrix.architecture == 'armv7' && 'armv7l') || matrix.architecture }}"
219 chmod +x ./dist/yt-dlp_linux_${arch}
220 cp ./dist/yt-dlp_linux_${arch} ./dist/yt-dlp_linux_${arch}_downgraded
221 version="$(./dist/yt-dlp_linux_${arch} --version)"
222 ./dist/yt-dlp_linux_${arch}_downgraded -v --update-to yt-dlp/yt-dlp@2023.03.04
223 downgraded_version="$(./dist/yt-dlp_linux_${arch}_downgraded --version)"
224 [[ "$version" != "$downgraded_version" ]]
227 - name: Upload artifacts
228 uses: actions/upload-artifact@v4
230 name: build-linux_${{ matrix.architecture }}
231 path: | # run-on-arch-action designates armv7l as armv7
232 repo/dist/yt-dlp_linux_${{ (matrix.architecture == 'armv7' && 'armv7l') || matrix.architecture }}
241 - uses: actions/checkout@v4
242 # NB: Building universal2 does not work with python from actions/setup-python
243 - name: Install Requirements
245 brew install coreutils
246 python3 devscripts/install_deps.py --user -o --include build
247 python3 devscripts/install_deps.py --print --include pyinstaller > requirements.txt
248 # We need to ignore wheels otherwise we break universal2 builds
249 python3 -m pip install -U --user --no-binary :all: -r requirements.txt
253 python3 devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
254 python3 devscripts/make_lazy_extractors.py
257 python3 -m bundle.pyinstaller --target-architecture universal2 --onedir
258 (cd ./dist/yt-dlp_macos && zip -r ../yt-dlp_macos.zip .)
259 python3 -m bundle.pyinstaller --target-architecture universal2
261 - name: Verify --update-to
262 if: vars.UPDATE_TO_VERIFICATION
264 chmod +x ./dist/yt-dlp_macos
265 cp ./dist/yt-dlp_macos ./dist/yt-dlp_macos_downgraded
266 version="$(./dist/yt-dlp_macos --version)"
267 ./dist/yt-dlp_macos_downgraded -v --update-to yt-dlp/yt-dlp@2023.03.04
268 downgraded_version="$(./dist/yt-dlp_macos_downgraded --version)"
269 [[ "$version" != "$downgraded_version" ]]
271 - name: Upload artifacts
272 uses: actions/upload-artifact@v4
274 name: build-${{ github.job }}
277 dist/yt-dlp_macos.zip
282 if: inputs.macos_legacy
283 runs-on: macos-latest
286 - uses: actions/checkout@v4
287 - name: Install Python
288 # We need the official Python, because the GA ones only support newer macOS versions
290 PYTHON_VERSION: 3.10.5
291 MACOSX_DEPLOYMENT_TARGET: 10.9 # Used up by the Python build tools
293 # Hack to get the latest patch version. Uncomment if needed
294 #brew install python@3.10
295 #export PYTHON_VERSION=$( $(brew --prefix)/opt/python@3.10/bin/python3 --version | cut -d ' ' -f 2 )
296 curl https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-macos11.pkg -o "python.pkg"
297 sudo installer -pkg python.pkg -target /
299 - name: Install Requirements
301 brew install coreutils
302 python3 devscripts/install_deps.py --user -o --include build
303 python3 devscripts/install_deps.py --user --include pyinstaller
307 python3 devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
308 python3 devscripts/make_lazy_extractors.py
311 python3 -m bundle.pyinstaller
312 mv dist/yt-dlp_macos dist/yt-dlp_macos_legacy
314 - name: Verify --update-to
315 if: vars.UPDATE_TO_VERIFICATION
317 chmod +x ./dist/yt-dlp_macos_legacy
318 cp ./dist/yt-dlp_macos_legacy ./dist/yt-dlp_macos_legacy_downgraded
319 version="$(./dist/yt-dlp_macos_legacy --version)"
320 ./dist/yt-dlp_macos_legacy_downgraded -v --update-to yt-dlp/yt-dlp@2023.03.04
321 downgraded_version="$(./dist/yt-dlp_macos_legacy_downgraded --version)"
322 [[ "$version" != "$downgraded_version" ]]
324 - name: Upload artifacts
325 uses: actions/upload-artifact@v4
327 name: build-${{ github.job }}
329 dist/yt-dlp_macos_legacy
335 runs-on: windows-latest
338 - uses: actions/checkout@v4
339 - uses: actions/setup-python@v5
340 with: # 3.8 is used for Win7 support
341 python-version: "3.8"
342 - name: Install Requirements
343 run: | # Custom pyinstaller built with https://github.com/yt-dlp/pyinstaller-builds
344 python devscripts/install_deps.py -o --include build
345 python devscripts/install_deps.py --include py2exe
346 python -m pip install -U "https://yt-dlp.github.io/Pyinstaller-Builds/x86_64/pyinstaller-5.8.0-py3-none-any.whl"
350 python devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
351 python devscripts/make_lazy_extractors.py
354 python -m bundle.py2exe
355 Move-Item ./dist/yt-dlp.exe ./dist/yt-dlp_min.exe
356 python -m bundle.pyinstaller
357 python -m bundle.pyinstaller --onedir
358 Compress-Archive -Path ./dist/yt-dlp/* -DestinationPath ./dist/yt-dlp_win.zip
360 - name: Verify --update-to
361 if: vars.UPDATE_TO_VERIFICATION
363 foreach ($name in @("yt-dlp","yt-dlp_min")) {
364 Copy-Item "./dist/${name}.exe" "./dist/${name}_downgraded.exe"
365 $version = & "./dist/${name}.exe" --version
366 & "./dist/${name}_downgraded.exe" -v --update-to yt-dlp/yt-dlp@2023.03.04
367 $downgraded_version = & "./dist/${name}_downgraded.exe" --version
368 if ($version -eq $downgraded_version) {
373 - name: Upload artifacts
374 uses: actions/upload-artifact@v4
376 name: build-${{ github.job }}
386 runs-on: windows-latest
389 - uses: actions/checkout@v4
390 - uses: actions/setup-python@v5
392 python-version: "3.8"
394 - name: Install Requirements
396 python devscripts/install_deps.py -o --include build
397 python devscripts/install_deps.py
398 python -m pip install -U "https://yt-dlp.github.io/Pyinstaller-Builds/i686/pyinstaller-5.8.0-py3-none-any.whl"
402 python devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
403 python devscripts/make_lazy_extractors.py
406 python -m bundle.pyinstaller
408 - name: Verify --update-to
409 if: vars.UPDATE_TO_VERIFICATION
411 foreach ($name in @("yt-dlp_x86")) {
412 Copy-Item "./dist/${name}.exe" "./dist/${name}_downgraded.exe"
413 $version = & "./dist/${name}.exe" --version
414 & "./dist/${name}_downgraded.exe" -v --update-to yt-dlp/yt-dlp@2023.03.04
415 $downgraded_version = & "./dist/${name}_downgraded.exe" --version
416 if ($version -eq $downgraded_version) {
421 - name: Upload artifacts
422 uses: actions/upload-artifact@v4
424 name: build-${{ github.job }}
430 if: inputs.meta_files && always() && !cancelled()
439 runs-on: ubuntu-latest
441 - uses: actions/download-artifact@v4
447 - name: Make SHA2-SUMS files
450 sha256sum * > ../SHA2-256SUMS
451 sha512sum * > ../SHA2-512SUMS
453 - name: Make Update spec
455 cat >> _update_spec << EOF
456 # This file is used for regulating self-update
457 lock 2022.08.18.36 .+ Python 3\.6
458 lock 2023.11.16 (?!win_x86_exe).+ Python 3\.7
459 lock 2023.11.16 win_x86_exe .+ Windows-(?:Vista|2008Server)
460 lockV2 yt-dlp/yt-dlp 2022.08.18.36 .+ Python 3\.6
461 lockV2 yt-dlp/yt-dlp 2023.11.16 (?!win_x86_exe).+ Python 3\.7
462 lockV2 yt-dlp/yt-dlp 2023.11.16 win_x86_exe .+ Windows-(?:Vista|2008Server)
463 lockV2 yt-dlp/yt-dlp-nightly-builds 2023.11.15.232826 (?!win_x86_exe).+ Python 3\.7
464 lockV2 yt-dlp/yt-dlp-nightly-builds 2023.11.15.232826 win_x86_exe .+ Windows-(?:Vista|2008Server)
465 lockV2 yt-dlp/yt-dlp-master-builds 2023.11.15.232812 (?!win_x86_exe).+ Python 3\.7
466 lockV2 yt-dlp/yt-dlp-master-builds 2023.11.15.232812 win_x86_exe .+ Windows-(?:Vista|2008Server)
469 - name: Sign checksum files
471 GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
472 if: env.GPG_SIGNING_KEY != ''
474 gpg --batch --import <<< "${{ secrets.GPG_SIGNING_KEY }}"
475 for signfile in ./SHA*SUMS; do
476 gpg --batch --detach-sign "$signfile"
479 - name: Upload artifacts
480 uses: actions/upload-artifact@v4
482 name: build-${{ github.job }}