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