]>
Commit | Line | Data |
---|---|---|
29cb20bd SS |
1 | name: Build Artifacts |
2 | on: | |
3 | workflow_call: | |
4 | inputs: | |
5 | version: | |
6 | required: true | |
7 | type: string | |
8 | channel: | |
9 | required: false | |
10 | default: stable | |
11 | type: string | |
12 | unix: | |
13 | default: true | |
14 | type: boolean | |
15 | linux_arm: | |
16 | default: true | |
17 | type: boolean | |
18 | macos: | |
19 | default: true | |
20 | type: boolean | |
21 | macos_legacy: | |
22 | default: true | |
23 | type: boolean | |
24 | windows: | |
25 | default: true | |
26 | type: boolean | |
27 | windows32: | |
28 | default: true | |
29 | type: boolean | |
30 | meta_files: | |
31 | default: true | |
32 | type: boolean | |
20314dd4 | 33 | origin: |
34 | required: false | |
35 | default: '' | |
36 | type: string | |
12647e03 SS |
37 | secrets: |
38 | GPG_SIGNING_KEY: | |
39 | required: false | |
29cb20bd SS |
40 | |
41 | workflow_dispatch: | |
42 | inputs: | |
43 | version: | |
20314dd4 | 44 | description: | |
45 | VERSION: yyyy.mm.dd[.rev] or rev | |
29cb20bd SS |
46 | required: true |
47 | type: string | |
48 | channel: | |
20314dd4 | 49 | description: | |
50 | SOURCE of this build's updates: stable/nightly/master/<repo> | |
29cb20bd SS |
51 | required: true |
52 | default: stable | |
53 | type: string | |
54 | unix: | |
55 | description: yt-dlp, yt-dlp.tar.gz, yt-dlp_linux, yt-dlp_linux.zip | |
56 | default: true | |
57 | type: boolean | |
58 | linux_arm: | |
59 | description: yt-dlp_linux_aarch64, yt-dlp_linux_armv7l | |
60 | default: true | |
61 | type: boolean | |
62 | macos: | |
63 | description: yt-dlp_macos, yt-dlp_macos.zip | |
64 | default: true | |
65 | type: boolean | |
66 | macos_legacy: | |
67 | description: yt-dlp_macos_legacy | |
68 | default: true | |
69 | type: boolean | |
70 | windows: | |
71 | description: yt-dlp.exe, yt-dlp_min.exe, yt-dlp_win.zip | |
72 | default: true | |
73 | type: boolean | |
74 | windows32: | |
75 | description: yt-dlp_x86.exe | |
76 | default: true | |
77 | type: boolean | |
78 | meta_files: | |
79 | description: SHA2-256SUMS, SHA2-512SUMS, _update_spec | |
80 | default: true | |
81 | type: boolean | |
20314dd4 | 82 | origin: |
632b8ee5 | 83 | description: Origin |
20314dd4 | 84 | required: false |
632b8ee5 | 85 | default: 'current repo' |
20314dd4 | 86 | type: choice |
87 | options: | |
632b8ee5 | 88 | - 'current repo' |
29cb20bd | 89 | |
c789fb77 A |
90 | permissions: |
91 | contents: read | |
915f2a92 U |
92 | |
93 | jobs: | |
20314dd4 | 94 | process: |
95 | runs-on: ubuntu-latest | |
96 | outputs: | |
97 | origin: ${{ steps.process_origin.outputs.origin }} | |
98 | steps: | |
99 | - name: Process origin | |
100 | id: process_origin | |
101 | run: | | |
632b8ee5 | 102 | echo "origin=${{ inputs.origin == 'current repo' && github.repository || inputs.origin }}" | tee "$GITHUB_OUTPUT" |
20314dd4 | 103 | |
29cb20bd | 104 | unix: |
20314dd4 | 105 | needs: process |
29cb20bd | 106 | if: inputs.unix |
a6858cda | 107 | runs-on: ubuntu-latest |
b5899f4f | 108 | steps: |
5438593a | 109 | - uses: actions/checkout@v4 |
b14e818b | 110 | - uses: actions/setup-python@v5 |
29cb20bd SS |
111 | with: |
112 | python-version: "3.10" | |
b0059f04 | 113 | - uses: conda-incubator/setup-miniconda@v3 |
29cb20bd | 114 | with: |
a6858cda | 115 | miniforge-variant: Mambaforge |
116 | use-mamba: true | |
117 | channels: conda-forge | |
118 | auto-update-conda: true | |
29cb20bd | 119 | activate-environment: "" |
a6858cda | 120 | auto-activate-base: false |
29cb20bd SS |
121 | - name: Install Requirements |
122 | run: | | |
1d03633c | 123 | sudo apt -y install zip pandoc man sed |
b8a433aa | 124 | cat > ./requirements.txt << EOF |
776d1c3f | 125 | python=3.10.* |
776d1c3f | 126 | brotli-python |
127 | EOF | |
b8a433aa | 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 | |
b5899f4f | 132 | |
29cb20bd SS |
133 | - name: Prepare |
134 | run: | | |
20314dd4 | 135 | python devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}" |
b5899f4f | 136 | python devscripts/make_lazy_extractors.py |
29cb20bd SS |
137 | - name: Build Unix platform-independent binary |
138 | run: | | |
b5899f4f | 139 | make all tar |
29cb20bd SS |
140 | - name: Build Unix standalone binary |
141 | shell: bash -l {0} | |
142 | run: | | |
a6858cda | 143 | unset LD_LIBRARY_PATH # Harmful; set by setup-python |
144 | conda activate build | |
a1b77842 | 145 | python -m bundle.pyinstaller --onedir |
e4afcfde | 146 | (cd ./dist/yt-dlp_linux && zip -r ../yt-dlp_linux.zip .) |
a1b77842 | 147 | python -m bundle.pyinstaller |
29cb20bd SS |
148 | mv ./dist/yt-dlp_linux ./yt-dlp_linux |
149 | mv ./dist/yt-dlp_linux.zip ./yt-dlp_linux.zip | |
150 | ||
b73193c9 | 151 | - name: Verify --update-to |
152 | if: vars.UPDATE_TO_VERIFICATION | |
153 | run: | | |
154 | binaries=("yt-dlp" "yt-dlp_linux") | |
155 | for binary in "${binaries[@]}"; do | |
156 | chmod +x ./${binary} | |
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" ]] | |
162 | done | |
163 | ||
29cb20bd SS |
164 | - name: Upload artifacts |
165 | uses: actions/upload-artifact@v3 | |
166 | with: | |
167 | path: | | |
168 | yt-dlp | |
169 | yt-dlp.tar.gz | |
170 | yt-dlp_linux | |
171 | yt-dlp_linux.zip | |
172 | ||
173 | linux_arm: | |
20314dd4 | 174 | needs: process |
29cb20bd | 175 | if: inputs.linux_arm |
17fc3dc4 | 176 | permissions: |
29cb20bd SS |
177 | contents: read |
178 | packages: write # for creating cache | |
17fc3dc4 | 179 | runs-on: ubuntu-latest |
17fc3dc4 M |
180 | strategy: |
181 | matrix: | |
182 | architecture: | |
29cb20bd SS |
183 | - armv7 |
184 | - aarch64 | |
17fc3dc4 M |
185 | |
186 | steps: | |
5438593a | 187 | - uses: actions/checkout@v4 |
29cb20bd SS |
188 | with: |
189 | path: ./repo | |
190 | - name: Virtualized Install, Prepare & Build | |
191 | uses: yt-dlp/run-on-arch-action@v2 | |
192 | with: | |
193 | # Ref: https://github.com/uraimo/run-on-arch-action/issues/55 | |
194 | env: | | |
195 | GITHUB_WORKFLOW: build | |
196 | githubToken: ${{ github.token }} # To cache image | |
197 | arch: ${{ matrix.architecture }} | |
198 | distro: ubuntu18.04 # Standalone executable should be built on minimum supported OS | |
199 | dockerRunArgs: --volume "${PWD}/repo:/repo" | |
200 | install: | # Installing Python 3.10 from the Deadsnakes repo raises errors | |
201 | apt update | |
92039763 | 202 | apt -y install zlib1g-dev libffi-dev python3.8 python3.8-dev python3.8-distutils python3-pip |
29cb20bd | 203 | python3.8 -m pip install -U pip setuptools wheel |
b8a433aa | 204 | # Cannot access any files from the repo directory at this stage |
92039763 | 205 | python3.8 -m pip install -U Pyinstaller mutagen pycryptodomex websockets brotli certifi secretstorage cffi |
29cb20bd SS |
206 | |
207 | run: | | |
208 | cd repo | |
b8a433aa | 209 | python3.8 devscripts/install_deps.py -o --include build |
210 | python3.8 devscripts/install_deps.py --include pyinstaller --include secretstorage # Cached version may be out of date | |
20314dd4 | 211 | python3.8 devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}" |
29cb20bd | 212 | python3.8 devscripts/make_lazy_extractors.py |
a1b77842 | 213 | python3.8 -m bundle.pyinstaller |
29cb20bd | 214 | |
b73193c9 | 215 | if ${{ vars.UPDATE_TO_VERIFICATION && 'true' || 'false' }}; then |
216 | arch="${{ (matrix.architecture == 'armv7' && 'armv7l') || matrix.architecture }}" | |
217 | chmod +x ./dist/yt-dlp_linux_${arch} | |
218 | cp ./dist/yt-dlp_linux_${arch} ./dist/yt-dlp_linux_${arch}_downgraded | |
219 | version="$(./dist/yt-dlp_linux_${arch} --version)" | |
220 | ./dist/yt-dlp_linux_${arch}_downgraded -v --update-to yt-dlp/yt-dlp@2023.03.04 | |
221 | downgraded_version="$(./dist/yt-dlp_linux_${arch}_downgraded --version)" | |
222 | [[ "$version" != "$downgraded_version" ]] | |
223 | fi | |
224 | ||
29cb20bd SS |
225 | - name: Upload artifacts |
226 | uses: actions/upload-artifact@v3 | |
227 | with: | |
228 | path: | # run-on-arch-action designates armv7l as armv7 | |
229 | repo/dist/yt-dlp_linux_${{ (matrix.architecture == 'armv7' && 'armv7l') || matrix.architecture }} | |
230 | ||
231 | macos: | |
20314dd4 | 232 | needs: process |
29cb20bd | 233 | if: inputs.macos |
0e5927ee | 234 | runs-on: macos-11 |
0e5927ee R |
235 | |
236 | steps: | |
5438593a | 237 | - uses: actions/checkout@v4 |
44a79958 | 238 | # NB: Building universal2 does not work with python from actions/setup-python |
29cb20bd SS |
239 | - name: Install Requirements |
240 | run: | | |
0e5927ee | 241 | brew install coreutils |
b8a433aa | 242 | python3 devscripts/install_deps.py --user -o --include build |
243 | python3 devscripts/install_deps.py --print --include pyinstaller > requirements.txt | |
44a79958 | 244 | # We need to ignore wheels otherwise we break universal2 builds |
b8a433aa | 245 | python3 -m pip install -U --user --no-binary :all: -r requirements.txt |
b5899f4f | 246 | |
29cb20bd SS |
247 | - name: Prepare |
248 | run: | | |
20314dd4 | 249 | python3 devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}" |
44a79958 | 250 | python3 devscripts/make_lazy_extractors.py |
29cb20bd SS |
251 | - name: Build |
252 | run: | | |
a1b77842 | 253 | python3 -m bundle.pyinstaller --target-architecture universal2 --onedir |
b5899f4f | 254 | (cd ./dist/yt-dlp_macos && zip -r ../yt-dlp_macos.zip .) |
a1b77842 | 255 | python3 -m bundle.pyinstaller --target-architecture universal2 |
b5899f4f | 256 | |
b73193c9 | 257 | - name: Verify --update-to |
258 | if: vars.UPDATE_TO_VERIFICATION | |
259 | run: | | |
260 | chmod +x ./dist/yt-dlp_macos | |
261 | cp ./dist/yt-dlp_macos ./dist/yt-dlp_macos_downgraded | |
262 | version="$(./dist/yt-dlp_macos --version)" | |
263 | ./dist/yt-dlp_macos_downgraded -v --update-to yt-dlp/yt-dlp@2023.03.04 | |
264 | downgraded_version="$(./dist/yt-dlp_macos_downgraded --version)" | |
265 | [[ "$version" != "$downgraded_version" ]] | |
266 | ||
29cb20bd SS |
267 | - name: Upload artifacts |
268 | uses: actions/upload-artifact@v3 | |
269 | with: | |
270 | path: | | |
271 | dist/yt-dlp_macos | |
272 | dist/yt-dlp_macos.zip | |
b5899f4f | 273 | |
29cb20bd | 274 | macos_legacy: |
20314dd4 | 275 | needs: process |
29cb20bd | 276 | if: inputs.macos_legacy |
6d916fe7 | 277 | runs-on: macos-latest |
28cdb605 | 278 | |
6d916fe7 | 279 | steps: |
5438593a | 280 | - uses: actions/checkout@v4 |
29cb20bd SS |
281 | - name: Install Python |
282 | # We need the official Python, because the GA ones only support newer macOS versions | |
283 | env: | |
284 | PYTHON_VERSION: 3.10.5 | |
285 | MACOSX_DEPLOYMENT_TARGET: 10.9 # Used up by the Python build tools | |
286 | run: | | |
6d916fe7 SL |
287 | # Hack to get the latest patch version. Uncomment if needed |
288 | #brew install python@3.10 | |
289 | #export PYTHON_VERSION=$( $(brew --prefix)/opt/python@3.10/bin/python3 --version | cut -d ' ' -f 2 ) | |
290 | curl https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-macos11.pkg -o "python.pkg" | |
291 | sudo installer -pkg python.pkg -target / | |
292 | python3 --version | |
29cb20bd SS |
293 | - name: Install Requirements |
294 | run: | | |
6d916fe7 | 295 | brew install coreutils |
b8a433aa | 296 | python3 devscripts/install_deps.py --user -o --include build |
297 | python3 devscripts/install_deps.py --user --include pyinstaller | |
6d916fe7 | 298 | |
29cb20bd SS |
299 | - name: Prepare |
300 | run: | | |
20314dd4 | 301 | python3 devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}" |
6d916fe7 | 302 | python3 devscripts/make_lazy_extractors.py |
29cb20bd SS |
303 | - name: Build |
304 | run: | | |
a1b77842 | 305 | python3 -m bundle.pyinstaller |
c4b6c5c7 | 306 | mv dist/yt-dlp_macos dist/yt-dlp_macos_legacy |
6d916fe7 | 307 | |
b73193c9 | 308 | - name: Verify --update-to |
309 | if: vars.UPDATE_TO_VERIFICATION | |
310 | run: | | |
311 | chmod +x ./dist/yt-dlp_macos_legacy | |
312 | cp ./dist/yt-dlp_macos_legacy ./dist/yt-dlp_macos_legacy_downgraded | |
313 | version="$(./dist/yt-dlp_macos_legacy --version)" | |
314 | ./dist/yt-dlp_macos_legacy_downgraded -v --update-to yt-dlp/yt-dlp@2023.03.04 | |
315 | downgraded_version="$(./dist/yt-dlp_macos_legacy_downgraded --version)" | |
316 | [[ "$version" != "$downgraded_version" ]] | |
317 | ||
29cb20bd SS |
318 | - name: Upload artifacts |
319 | uses: actions/upload-artifact@v3 | |
320 | with: | |
321 | path: | | |
322 | dist/yt-dlp_macos_legacy | |
6d916fe7 | 323 | |
29cb20bd | 324 | windows: |
20314dd4 | 325 | needs: process |
29cb20bd | 326 | if: inputs.windows |
915f2a92 | 327 | runs-on: windows-latest |
47930b73 | 328 | |
915f2a92 | 329 | steps: |
5438593a | 330 | - uses: actions/checkout@v4 |
b14e818b | 331 | - uses: actions/setup-python@v5 |
29cb20bd SS |
332 | with: # 3.8 is used for Win7 support |
333 | python-version: "3.8" | |
334 | - name: Install Requirements | |
335 | run: | # Custom pyinstaller built with https://github.com/yt-dlp/pyinstaller-builds | |
b8a433aa | 336 | python devscripts/install_deps.py -o --include build |
337 | python devscripts/install_deps.py --include py2exe | |
338 | python -m pip install -U "https://yt-dlp.github.io/Pyinstaller-Builds/x86_64/pyinstaller-5.8.0-py3-none-any.whl" | |
b5899f4f | 339 | |
29cb20bd SS |
340 | - name: Prepare |
341 | run: | | |
20314dd4 | 342 | python devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}" |
b5899f4f | 343 | python devscripts/make_lazy_extractors.py |
29cb20bd SS |
344 | - name: Build |
345 | run: | | |
a1b77842 | 346 | python -m bundle.py2exe |
b5899f4f | 347 | Move-Item ./dist/yt-dlp.exe ./dist/yt-dlp_min.exe |
a1b77842 | 348 | python -m bundle.pyinstaller |
349 | python -m bundle.pyinstaller --onedir | |
b5899f4f | 350 | Compress-Archive -Path ./dist/yt-dlp/* -DestinationPath ./dist/yt-dlp_win.zip |
c4b6c5c7 | 351 | |
b73193c9 | 352 | - name: Verify --update-to |
353 | if: vars.UPDATE_TO_VERIFICATION | |
354 | run: | | |
355 | foreach ($name in @("yt-dlp","yt-dlp_min")) { | |
356 | Copy-Item "./dist/${name}.exe" "./dist/${name}_downgraded.exe" | |
357 | $version = & "./dist/${name}.exe" --version | |
358 | & "./dist/${name}_downgraded.exe" -v --update-to yt-dlp/yt-dlp@2023.03.04 | |
359 | $downgraded_version = & "./dist/${name}_downgraded.exe" --version | |
360 | if ($version -eq $downgraded_version) { | |
361 | exit 1 | |
362 | } | |
363 | } | |
364 | ||
29cb20bd SS |
365 | - name: Upload artifacts |
366 | uses: actions/upload-artifact@v3 | |
367 | with: | |
368 | path: | | |
369 | dist/yt-dlp.exe | |
370 | dist/yt-dlp_min.exe | |
371 | dist/yt-dlp_win.zip | |
386cdfdb | 372 | |
29cb20bd | 373 | windows32: |
20314dd4 | 374 | needs: process |
29cb20bd | 375 | if: inputs.windows32 |
915f2a92 | 376 | runs-on: windows-latest |
47930b73 | 377 | |
915f2a92 | 378 | steps: |
5438593a | 379 | - uses: actions/checkout@v4 |
b14e818b | 380 | - uses: actions/setup-python@v5 |
f4b95aca | 381 | with: |
382 | python-version: "3.8" | |
29cb20bd SS |
383 | architecture: "x86" |
384 | - name: Install Requirements | |
385 | run: | | |
b8a433aa | 386 | python devscripts/install_deps.py -o --include build |
387 | python devscripts/install_deps.py | |
388 | python -m pip install -U "https://yt-dlp.github.io/Pyinstaller-Builds/i686/pyinstaller-5.8.0-py3-none-any.whl" | |
b5899f4f | 389 | |
29cb20bd SS |
390 | - name: Prepare |
391 | run: | | |
20314dd4 | 392 | python devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}" |
b5899f4f | 393 | python devscripts/make_lazy_extractors.py |
29cb20bd SS |
394 | - name: Build |
395 | run: | | |
a1b77842 | 396 | python -m bundle.pyinstaller |
b5899f4f | 397 | |
b73193c9 | 398 | - name: Verify --update-to |
399 | if: vars.UPDATE_TO_VERIFICATION | |
400 | run: | | |
401 | foreach ($name in @("yt-dlp_x86")) { | |
402 | Copy-Item "./dist/${name}.exe" "./dist/${name}_downgraded.exe" | |
403 | $version = & "./dist/${name}.exe" --version | |
404 | & "./dist/${name}_downgraded.exe" -v --update-to yt-dlp/yt-dlp@2023.03.04 | |
405 | $downgraded_version = & "./dist/${name}_downgraded.exe" --version | |
406 | if ($version -eq $downgraded_version) { | |
407 | exit 1 | |
408 | } | |
409 | } | |
410 | ||
29cb20bd SS |
411 | - name: Upload artifacts |
412 | uses: actions/upload-artifact@v3 | |
413 | with: | |
414 | path: | | |
415 | dist/yt-dlp_x86.exe | |
416 | ||
417 | meta_files: | |
c4efa0ae | 418 | if: inputs.meta_files && always() && !cancelled() |
29cb20bd | 419 | needs: |
20314dd4 | 420 | - process |
29cb20bd SS |
421 | - unix |
422 | - linux_arm | |
423 | - macos | |
424 | - macos_legacy | |
425 | - windows | |
426 | - windows32 | |
14b17a55 | 427 | runs-on: ubuntu-latest |
14b17a55 | 428 | steps: |
29cb20bd | 429 | - uses: actions/download-artifact@v3 |
b1f94422 | 430 | |
29cb20bd SS |
431 | - name: Make SHA2-SUMS files |
432 | run: | | |
433 | cd ./artifact/ | |
434 | sha256sum * > ../SHA2-256SUMS | |
435 | sha512sum * > ../SHA2-512SUMS | |
c4b6c5c7 | 436 | |
29cb20bd SS |
437 | - name: Make Update spec |
438 | run: | | |
439 | cat >> _update_spec << EOF | |
440 | # This file is used for regulating self-update | |
f4b95aca | 441 | lock 2022.08.18.36 .+ Python 3\.6 |
442 | lock 2023.11.16 (?!win_x86_exe).+ Python 3\.7 | |
443 | lock 2023.11.16 win_x86_exe .+ Windows-(?:Vista|2008Server) | |
444 | lockV2 yt-dlp/yt-dlp 2022.08.18.36 .+ Python 3\.6 | |
445 | lockV2 yt-dlp/yt-dlp 2023.11.16 (?!win_x86_exe).+ Python 3\.7 | |
446 | lockV2 yt-dlp/yt-dlp 2023.11.16 win_x86_exe .+ Windows-(?:Vista|2008Server) | |
447 | lockV2 yt-dlp/yt-dlp-nightly-builds 2023.11.15.232826 (?!win_x86_exe).+ Python 3\.7 | |
448 | lockV2 yt-dlp/yt-dlp-nightly-builds 2023.11.15.232826 win_x86_exe .+ Windows-(?:Vista|2008Server) | |
449 | lockV2 yt-dlp/yt-dlp-master-builds 2023.11.15.232812 (?!win_x86_exe).+ Python 3\.7 | |
450 | lockV2 yt-dlp/yt-dlp-master-builds 2023.11.15.232812 win_x86_exe .+ Windows-(?:Vista|2008Server) | |
29cb20bd SS |
451 | EOF |
452 | ||
12647e03 SS |
453 | - name: Sign checksum files |
454 | env: | |
455 | GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} | |
456 | if: env.GPG_SIGNING_KEY != '' | |
457 | run: | | |
458 | gpg --batch --import <<< "${{ secrets.GPG_SIGNING_KEY }}" | |
459 | for signfile in ./SHA*SUMS; do | |
460 | gpg --batch --detach-sign "$signfile" | |
461 | done | |
462 | ||
29cb20bd SS |
463 | - name: Upload artifacts |
464 | uses: actions/upload-artifact@v3 | |
465 | with: | |
466 | path: | | |
467 | SHA*SUMS* | |
468 | _update_spec |