]> jfr.im git - yt-dlp.git/blame - .github/workflows/build.yml
[rumble] Extract subtitles (#3823)
[yt-dlp.git] / .github / workflows / build.yml
CommitLineData
915f2a92 1name: Build
75b725a7 2on: workflow_dispatch
915f2a92
U
3
4jobs:
93721ed0 5 build_unix:
915f2a92 6 runs-on: ubuntu-latest
915f2a92 7 outputs:
75b725a7 8 version_suffix: ${{ steps.version_suffix.outputs.version_suffix }}
7a5c1cfe 9 ytdlp_version: ${{ steps.bump_version.outputs.ytdlp_version }}
915f2a92 10 upload_url: ${{ steps.create_release.outputs.upload_url }}
4c88ff87 11 sha256_bin: ${{ steps.sha256_bin.outputs.sha256_bin }}
12 sha512_bin: ${{ steps.sha512_bin.outputs.sha512_bin }}
13 sha256_tar: ${{ steps.sha256_tar.outputs.sha256_tar }}
14 sha512_tar: ${{ steps.sha512_tar.outputs.sha512_tar }}
915f2a92
U
15
16 steps:
17 - uses: actions/checkout@v2
4c88ff87 18 with:
19 fetch-depth: 0
915f2a92
U
20 - name: Set up Python
21 uses: actions/setup-python@v2
22 with:
764876a0 23 python-version: '3.8'
915f2a92
U
24 - name: Install packages
25 run: sudo apt-get -y install zip pandoc man
75b725a7 26 - name: Set version suffix
27 id: version_suffix
28 env:
29 PUSH_VERSION_COMMIT: ${{ secrets.PUSH_VERSION_COMMIT }}
30 if: "env.PUSH_VERSION_COMMIT == ''"
31 run: echo ::set-output name=version_suffix::$(date -u +"%H%M%S")
915f2a92
U
32 - name: Bump version
33 id: bump_version
4c88ff87 34 run: |
75b725a7 35 python devscripts/update-version.py ${{ steps.version_suffix.outputs.version_suffix }}
4c88ff87 36 make issuetemplates
75b725a7 37 - name: Push to release
38 id: push_release
4c88ff87 39 run: |
75b725a7 40 git config --global user.name github-actions
41 git config --global user.email github-actions@example.com
4c88ff87 42 git add -u
75b725a7 43 git commit -m "[version] update" -m "Created by: ${{ github.event.sender.login }}" -m ":ci skip all"
44 git push origin --force ${{ github.event.ref }}:release
4c88ff87 45 echo ::set-output name=head_sha::$(git rev-parse HEAD)
75b725a7 46 - name: Update master
47 id: push_master
48 env:
49 PUSH_VERSION_COMMIT: ${{ secrets.PUSH_VERSION_COMMIT }}
50 if: "env.PUSH_VERSION_COMMIT != ''"
51 run: git push origin ${{ github.event.ref }}
4c88ff87 52 - name: Get Changelog
53 id: get_changelog
54 run: |
84999521 55 changelog=$(cat Changelog.md | grep -oPz '(?s)(?<=### ${{ steps.bump_version.outputs.ytdlp_version }}\n{2}).+?(?=\n{2,3}###)') || true
4c88ff87 56 echo "changelog<<EOF" >> $GITHUB_ENV
57 echo "$changelog" >> $GITHUB_ENV
58 echo "EOF" >> $GITHUB_ENV
6e21fdd2 59
60 - name: Build lazy extractors
61 id: lazy_extractors
49a57e70 62 run: python devscripts/make_lazy_extractors.py
915f2a92 63 - name: Run Make
ed64ce59 64 run: make all tar
4c88ff87 65 - name: Get SHA2-256SUMS for yt-dlp
66 id: sha256_bin
67 run: echo "::set-output name=sha256_bin::$(sha256sum yt-dlp | awk '{print $1}')"
68 - name: Get SHA2-256SUMS for yt-dlp.tar.gz
69 id: sha256_tar
70 run: echo "::set-output name=sha256_tar::$(sha256sum yt-dlp.tar.gz | awk '{print $1}')"
71 - name: Get SHA2-512SUMS for yt-dlp
72 id: sha512_bin
73 run: echo "::set-output name=sha512_bin::$(sha512sum yt-dlp | awk '{print $1}')"
74 - name: Get SHA2-512SUMS for yt-dlp.tar.gz
75 id: sha512_tar
76 run: echo "::set-output name=sha512_tar::$(sha512sum yt-dlp.tar.gz | awk '{print $1}')"
733d8e8f 77
a5de4099 78 - name: Install dependencies for pypi
79 env:
80 PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
81 if: "env.PYPI_TOKEN != ''"
82 run: |
83 python -m pip install --upgrade pip
84 pip install setuptools wheel twine
85 - name: Build and publish on pypi
86 env:
87 TWINE_USERNAME: __token__
88 TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
89 if: "env.TWINE_PASSWORD != ''"
90 run: |
91 rm -rf dist/*
92 python setup.py sdist bdist_wheel
93 twine upload dist/*
733d8e8f 94
4c88ff87 95 - name: Install SSH private key
96 env:
97 BREW_TOKEN: ${{ secrets.BREW_TOKEN }}
98 if: "env.BREW_TOKEN != ''"
767f999b 99 uses: yt-dlp/ssh-agent@v0.5.3
4c88ff87 100 with:
101 ssh-private-key: ${{ env.BREW_TOKEN }}
102 - name: Update Homebrew Formulae
103 env:
104 BREW_TOKEN: ${{ secrets.BREW_TOKEN }}
105 if: "env.BREW_TOKEN != ''"
106 run: |
107 git clone git@github.com:yt-dlp/homebrew-taps taps/
108 python3 devscripts/update-formulae.py taps/Formula/yt-dlp.rb "${{ steps.bump_version.outputs.ytdlp_version }}"
109 git -C taps/ config user.name github-actions
110 git -C taps/ config user.email github-actions@example.com
111 git -C taps/ commit -am 'yt-dlp: ${{ steps.bump_version.outputs.ytdlp_version }}'
112 git -C taps/ push
733d8e8f 113
915f2a92
U
114 - name: Create Release
115 id: create_release
116 uses: actions/create-release@v1
117 env:
118 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
119 with:
7a5c1cfe
P
120 tag_name: ${{ steps.bump_version.outputs.ytdlp_version }}
121 release_name: yt-dlp ${{ steps.bump_version.outputs.ytdlp_version }}
a804f6d8 122 commitish: ${{ steps.push_release.outputs.head_sha }}
915f2a92 123 body: |
0930b11f 124 #### [A description of the various files]((https://github.com/yt-dlp/yt-dlp#release-files)) are in the README
49a57e70 125
126 ---
127
0930b11f 128 ### Changelog:
129 ${{ env.changelog }}
915f2a92
U
130 draft: false
131 prerelease: false
7a5c1cfe 132 - name: Upload yt-dlp Unix binary
14b17a55 133 id: upload-release-asset
915f2a92
U
134 uses: actions/upload-release-asset@v1
135 env:
136 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
137 with:
138 upload_url: ${{ steps.create_release.outputs.upload_url }}
7a5c1cfe
P
139 asset_path: ./yt-dlp
140 asset_name: yt-dlp
915f2a92 141 asset_content_type: application/octet-stream
ed64ce59 142 - name: Upload Source tar
143 uses: actions/upload-release-asset@v1
144 env:
145 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
146 with:
147 upload_url: ${{ steps.create_release.outputs.upload_url }}
148 asset_path: ./yt-dlp.tar.gz
149 asset_name: yt-dlp.tar.gz
150 asset_content_type: application/gzip
915f2a92 151
0e5927ee
R
152 build_macos:
153 runs-on: macos-11
154 needs: build_unix
0e5927ee
R
155 outputs:
156 sha256_macos: ${{ steps.sha256_macos.outputs.sha256_macos }}
157 sha512_macos: ${{ steps.sha512_macos.outputs.sha512_macos }}
158 sha256_macos_zip: ${{ steps.sha256_macos_zip.outputs.sha256_macos_zip }}
159 sha512_macos_zip: ${{ steps.sha512_macos_zip.outputs.sha512_macos_zip }}
160
161 steps:
162 - uses: actions/checkout@v2
163 # In order to create a universal2 application, the version of python3 in /usr/bin has to be used
164 - name: Install Requirements
165 run: |
166 brew install coreutils
b46ccbc6 167 /usr/bin/python3 -m pip install -U --user pip Pyinstaller==4.10 -r requirements.txt
0e5927ee
R
168 - name: Bump version
169 id: bump_version
733d8e8f 170 run: /usr/bin/python3 devscripts/update-version.py
6e21fdd2 171 - name: Build lazy extractors
172 id: lazy_extractors
49a57e70 173 run: /usr/bin/python3 devscripts/make_lazy_extractors.py
0e5927ee 174 - name: Run PyInstaller Script
733d8e8f 175 run: /usr/bin/python3 pyinst.py --target-architecture universal2 --onefile
0e5927ee
R
176 - name: Upload yt-dlp MacOS binary
177 id: upload-release-macos
178 uses: actions/upload-release-asset@v1
179 env:
180 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
181 with:
182 upload_url: ${{ needs.build_unix.outputs.upload_url }}
183 asset_path: ./dist/yt-dlp_macos
184 asset_name: yt-dlp_macos
185 asset_content_type: application/octet-stream
186 - name: Get SHA2-256SUMS for yt-dlp_macos
187 id: sha256_macos
188 run: echo "::set-output name=sha256_macos::$(sha256sum dist/yt-dlp_macos | awk '{print $1}')"
189 - name: Get SHA2-512SUMS for yt-dlp_macos
190 id: sha512_macos
191 run: echo "::set-output name=sha512_macos::$(sha512sum dist/yt-dlp_macos | awk '{print $1}')"
192
193 - name: Run PyInstaller Script with --onedir
767f999b 194 run: |
195 /usr/bin/python3 pyinst.py --target-architecture universal2 --onedir
196 zip ./dist/yt-dlp_macos.zip ./dist/yt-dlp_macos
0e5927ee
R
197 - name: Upload yt-dlp MacOS onedir
198 id: upload-release-macos-zip
199 uses: actions/upload-release-asset@v1
200 env:
201 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
202 with:
203 upload_url: ${{ needs.build_unix.outputs.upload_url }}
204 asset_path: ./dist/yt-dlp_macos.zip
205 asset_name: yt-dlp_macos.zip
206 asset_content_type: application/zip
207 - name: Get SHA2-256SUMS for yt-dlp_macos.zip
208 id: sha256_macos_zip
209 run: echo "::set-output name=sha256_macos_zip::$(sha256sum dist/yt-dlp_macos.zip | awk '{print $1}')"
9e907ebd 210 - name: Get SHA2-512SUMS for yt-dlp_macos.zip
0e5927ee
R
211 id: sha512_macos_zip
212 run: echo "::set-output name=sha512_macos_zip::$(sha512sum dist/yt-dlp_macos.zip | awk '{print $1}')"
213
7e8772bf 214 build_windows:
915f2a92 215 runs-on: windows-latest
14b17a55 216 needs: build_unix
47930b73 217 outputs:
4c88ff87 218 sha256_win: ${{ steps.sha256_win.outputs.sha256_win }}
219 sha512_win: ${{ steps.sha512_win.outputs.sha512_win }}
386cdfdb 220 sha256_py2exe: ${{ steps.sha256_py2exe.outputs.sha256_py2exe }}
221 sha512_py2exe: ${{ steps.sha512_py2exe.outputs.sha512_py2exe }}
4c88ff87 222 sha256_win_zip: ${{ steps.sha256_win_zip.outputs.sha256_win_zip }}
223 sha512_win_zip: ${{ steps.sha512_win_zip.outputs.sha512_win_zip }}
47930b73 224
915f2a92
U
225 steps:
226 - uses: actions/checkout@v2
0181adef 227 # 3.8 is used for Win7 support
228 - name: Set up Python 3.8
915f2a92
U
229 uses: actions/setup-python@v2
230 with:
da8fb75d 231 python-version: '3.8'
915f2a92 232 - name: Install Requirements
476febeb 233 # Custom pyinstaller built with https://github.com/yt-dlp/pyinstaller-builds
0e5927ee 234 run: |
386cdfdb 235 python -m pip install --upgrade pip setuptools wheel py2exe
b46ccbc6 236 pip install "https://yt-dlp.github.io/Pyinstaller-Builds/x86_64/pyinstaller-4.10-py3-none-any.whl" -r requirements.txt
915f2a92 237 - name: Bump version
e38df8f9 238 id: bump_version
75b725a7 239 env:
240 version_suffix: ${{ needs.build_unix.outputs.version_suffix }}
241 run: python devscripts/update-version.py ${{ env.version_suffix }}
6e21fdd2 242 - name: Build lazy extractors
243 id: lazy_extractors
49a57e70 244 run: python devscripts/make_lazy_extractors.py
915f2a92 245 - name: Run PyInstaller Script
5d535b4a 246 run: python pyinst.py
7a5c1cfe 247 - name: Upload yt-dlp.exe Windows binary
915f2a92
U
248 id: upload-release-windows
249 uses: actions/upload-release-asset@v1
250 env:
251 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
252 with:
253 upload_url: ${{ needs.build_unix.outputs.upload_url }}
7a5c1cfe
P
254 asset_path: ./dist/yt-dlp.exe
255 asset_name: yt-dlp.exe
98918847 256 asset_content_type: application/vnd.microsoft.portable-executable
7a5c1cfe 257 - name: Get SHA2-256SUMS for yt-dlp.exe
4c88ff87 258 id: sha256_win
259 run: echo "::set-output name=sha256_win::$((Get-FileHash dist\yt-dlp.exe -Algorithm SHA256).Hash.ToLower())"
beb982be 260 - name: Get SHA2-512SUMS for yt-dlp.exe
4c88ff87 261 id: sha512_win
262 run: echo "::set-output name=sha512_win::$((Get-FileHash dist\yt-dlp.exe -Algorithm SHA512).Hash.ToLower())"
733d8e8f 263
4c88ff87 264 - name: Run PyInstaller Script with --onedir
767f999b 265 run: |
266 python pyinst.py --onedir
267 Compress-Archive -LiteralPath ./dist/yt-dlp -DestinationPath ./dist/yt-dlp_win.zip
0e5927ee 268 - name: Upload yt-dlp Windows onedir
4c88ff87 269 id: upload-release-windows-zip
270 uses: actions/upload-release-asset@v1
271 env:
272 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
273 with:
274 upload_url: ${{ needs.build_unix.outputs.upload_url }}
0e5927ee
R
275 asset_path: ./dist/yt-dlp_win.zip
276 asset_name: yt-dlp_win.zip
4c88ff87 277 asset_content_type: application/zip
0e5927ee 278 - name: Get SHA2-256SUMS for yt-dlp_win.zip
4c88ff87 279 id: sha256_win_zip
0e5927ee
R
280 run: echo "::set-output name=sha256_win_zip::$((Get-FileHash dist\yt-dlp_win.zip -Algorithm SHA256).Hash.ToLower())"
281 - name: Get SHA2-512SUMS for yt-dlp_win.zip
4c88ff87 282 id: sha512_win_zip
0e5927ee 283 run: echo "::set-output name=sha512_win_zip::$((Get-FileHash dist\yt-dlp_win.zip -Algorithm SHA512).Hash.ToLower())"
915f2a92 284
386cdfdb 285 - name: Run py2exe Script
286 run: python setup.py py2exe
287 - name: Upload yt-dlp_min.exe Windows binary
288 id: upload-release-windows-py2exe
289 uses: actions/upload-release-asset@v1
290 env:
291 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
292 with:
293 upload_url: ${{ needs.build_unix.outputs.upload_url }}
294 asset_path: ./dist/yt-dlp.exe
295 asset_name: yt-dlp_min.exe
296 asset_content_type: application/vnd.microsoft.portable-executable
297 - name: Get SHA2-256SUMS for yt-dlp_min.exe
298 id: sha256_py2exe
299 run: echo "::set-output name=sha256_py2exe::$((Get-FileHash dist\yt-dlp.exe -Algorithm SHA256).Hash.ToLower())"
300 - name: Get SHA2-512SUMS for yt-dlp_min.exe
301 id: sha512_py2exe
302 run: echo "::set-output name=sha512_py2exe::$((Get-FileHash dist\yt-dlp.exe -Algorithm SHA512).Hash.ToLower())"
303
915f2a92 304 build_windows32:
915f2a92 305 runs-on: windows-latest
0e5927ee 306 needs: build_unix
915f2a92 307
47930b73 308 outputs:
4c88ff87 309 sha256_win32: ${{ steps.sha256_win32.outputs.sha256_win32 }}
310 sha512_win32: ${{ steps.sha512_win32.outputs.sha512_win32 }}
47930b73 311
915f2a92
U
312 steps:
313 - uses: actions/checkout@v2
0181adef 314 # 3.7 is used for Vista support. See https://github.com/yt-dlp/yt-dlp/issues/390
315 - name: Set up Python 3.7 32-Bit
915f2a92
U
316 uses: actions/setup-python@v2
317 with:
0181adef 318 python-version: '3.7'
915f2a92 319 architecture: 'x86'
0181adef 320 - name: Install Requirements
0e5927ee
R
321 run: |
322 python -m pip install --upgrade pip setuptools wheel
b46ccbc6 323 pip install "https://yt-dlp.github.io/Pyinstaller-Builds/i686/pyinstaller-4.10-py3-none-any.whl" -r requirements.txt
915f2a92 324 - name: Bump version
e38df8f9 325 id: bump_version
75b725a7 326 env:
327 version_suffix: ${{ needs.build_unix.outputs.version_suffix }}
328 run: python devscripts/update-version.py ${{ env.version_suffix }}
6e21fdd2 329 - name: Build lazy extractors
330 id: lazy_extractors
49a57e70 331 run: python devscripts/make_lazy_extractors.py
915f2a92 332 - name: Run PyInstaller Script for 32 Bit
5d535b4a 333 run: python pyinst.py
7a5c1cfe 334 - name: Upload Executable yt-dlp_x86.exe
915f2a92
U
335 id: upload-release-windows32
336 uses: actions/upload-release-asset@v1
337 env:
338 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
339 with:
340 upload_url: ${{ needs.build_unix.outputs.upload_url }}
7a5c1cfe
P
341 asset_path: ./dist/yt-dlp_x86.exe
342 asset_name: yt-dlp_x86.exe
98918847 343 asset_content_type: application/vnd.microsoft.portable-executable
7a5c1cfe 344 - name: Get SHA2-256SUMS for yt-dlp_x86.exe
4c88ff87 345 id: sha256_win32
346 run: echo "::set-output name=sha256_win32::$((Get-FileHash dist\yt-dlp_x86.exe -Algorithm SHA256).Hash.ToLower())"
beb982be 347 - name: Get SHA2-512SUMS for yt-dlp_x86.exe
4c88ff87 348 id: sha512_win32
349 run: echo "::set-output name=sha512_win32::$((Get-FileHash dist\yt-dlp_x86.exe -Algorithm SHA512).Hash.ToLower())"
14b17a55 350
351 finish:
352 runs-on: ubuntu-latest
13ab5fa5 353 needs: [build_unix, build_windows, build_windows32, build_macos]
14b17a55 354
355 steps:
915f2a92
U
356 - name: Make SHA2-256SUMS file
357 env:
733d8e8f 358 SHA256_BIN: ${{ needs.build_unix.outputs.sha256_bin }}
359 SHA256_TAR: ${{ needs.build_unix.outputs.sha256_tar }}
4c88ff87 360 SHA256_WIN: ${{ needs.build_windows.outputs.sha256_win }}
386cdfdb 361 SHA256_PY2EXE: ${{ needs.build_windows.outputs.sha256_py2exe }}
4c88ff87 362 SHA256_WIN_ZIP: ${{ needs.build_windows.outputs.sha256_win_zip }}
363 SHA256_WIN32: ${{ needs.build_windows32.outputs.sha256_win32 }}
0e5927ee
R
364 SHA256_MACOS: ${{ needs.build_macos.outputs.sha256_macos }}
365 SHA256_MACOS_ZIP: ${{ needs.build_macos.outputs.sha256_macos_zip }}
915f2a92 366 run: |
733d8e8f 367 echo "${{ env.SHA256_BIN }} yt-dlp" >> SHA2-256SUMS
368 echo "${{ env.SHA256_TAR }} yt-dlp.tar.gz" >> SHA2-256SUMS
4c88ff87 369 echo "${{ env.SHA256_WIN }} yt-dlp.exe" >> SHA2-256SUMS
386cdfdb 370 echo "${{ env.SHA256_PY2EXE }} yt-dlp_min.exe" >> SHA2-256SUMS
4c88ff87 371 echo "${{ env.SHA256_WIN32 }} yt-dlp_x86.exe" >> SHA2-256SUMS
733d8e8f 372 echo "${{ env.SHA256_WIN_ZIP }} yt-dlp_win.zip" >> SHA2-256SUMS
13ab5fa5 373 echo "${{ env.SHA256_MACOS }} yt-dlp_macos" >> SHA2-256SUMS
374 echo "${{ env.SHA256_MACOS_ZIP }} yt-dlp_macos.zip" >> SHA2-256SUMS
da6403d3
TOH
375 - name: Upload 256SUMS file
376 id: upload-sums
377 uses: actions/upload-release-asset@v1
378 env:
379 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
380 with:
381 upload_url: ${{ needs.build_unix.outputs.upload_url }}
382 asset_path: ./SHA2-256SUMS
383 asset_name: SHA2-256SUMS
384 asset_content_type: text/plain
beb982be
NA
385 - name: Make SHA2-512SUMS file
386 env:
733d8e8f 387 SHA512_BIN: ${{ needs.build_unix.outputs.sha512_bin }}
388 SHA512_TAR: ${{ needs.build_unix.outputs.sha512_tar }}
4c88ff87 389 SHA512_WIN: ${{ needs.build_windows.outputs.sha512_win }}
386cdfdb 390 SHA512_PY2EXE: ${{ needs.build_windows.outputs.sha512_py2exe }}
4c88ff87 391 SHA512_WIN_ZIP: ${{ needs.build_windows.outputs.sha512_win_zip }}
392 SHA512_WIN32: ${{ needs.build_windows32.outputs.sha512_win32 }}
0e5927ee
R
393 SHA512_MACOS: ${{ needs.build_macos.outputs.sha512_macos }}
394 SHA512_MACOS_ZIP: ${{ needs.build_macos.outputs.sha512_macos_zip }}
beb982be 395 run: |
733d8e8f 396 echo "${{ env.SHA512_BIN }} yt-dlp" >> SHA2-512SUMS
397 echo "${{ env.SHA512_TAR }} yt-dlp.tar.gz" >> SHA2-512SUMS
4c88ff87 398 echo "${{ env.SHA512_WIN }} yt-dlp.exe" >> SHA2-512SUMS
733d8e8f 399 echo "${{ env.SHA512_WIN_ZIP }} yt-dlp_win.zip" >> SHA2-512SUMS
386cdfdb 400 echo "${{ env.SHA512_PY2EXE }} yt-dlp_min.exe" >> SHA2-512SUMS
4c88ff87 401 echo "${{ env.SHA512_WIN32 }} yt-dlp_x86.exe" >> SHA2-512SUMS
13ab5fa5 402 echo "${{ env.SHA512_MACOS }} yt-dlp_macos" >> SHA2-512SUMS
403 echo "${{ env.SHA512_MACOS_ZIP }} yt-dlp_macos.zip" >> SHA2-512SUMS
beb982be
NA
404 - name: Upload 512SUMS file
405 id: upload-512sums
406 uses: actions/upload-release-asset@v1
407 env:
408 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
409 with:
410 upload_url: ${{ needs.build_unix.outputs.upload_url }}
411 asset_path: ./SHA2-512SUMS
412 asset_name: SHA2-512SUMS
413 asset_content_type: text/plain