]>
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 | |
33 | ||
34 | workflow_dispatch: | |
35 | inputs: | |
36 | version: | |
37 | description: Version tag (YYYY.MM.DD[.REV]) | |
38 | required: true | |
39 | type: string | |
40 | channel: | |
41 | description: Update channel (stable/nightly) | |
42 | required: true | |
43 | default: stable | |
44 | type: string | |
45 | unix: | |
46 | description: yt-dlp, yt-dlp.tar.gz, yt-dlp_linux, yt-dlp_linux.zip | |
47 | default: true | |
48 | type: boolean | |
49 | linux_arm: | |
50 | description: yt-dlp_linux_aarch64, yt-dlp_linux_armv7l | |
51 | default: true | |
52 | type: boolean | |
53 | macos: | |
54 | description: yt-dlp_macos, yt-dlp_macos.zip | |
55 | default: true | |
56 | type: boolean | |
57 | macos_legacy: | |
58 | description: yt-dlp_macos_legacy | |
59 | default: true | |
60 | type: boolean | |
61 | windows: | |
62 | description: yt-dlp.exe, yt-dlp_min.exe, yt-dlp_win.zip | |
63 | default: true | |
64 | type: boolean | |
65 | windows32: | |
66 | description: yt-dlp_x86.exe | |
67 | default: true | |
68 | type: boolean | |
69 | meta_files: | |
70 | description: SHA2-256SUMS, SHA2-512SUMS, _update_spec | |
71 | default: true | |
72 | type: boolean | |
73 | ||
c789fb77 A |
74 | permissions: |
75 | contents: read | |
915f2a92 U |
76 | |
77 | jobs: | |
29cb20bd SS |
78 | unix: |
79 | if: inputs.unix | |
a6858cda | 80 | runs-on: ubuntu-latest |
b5899f4f | 81 | steps: |
29cb20bd SS |
82 | - uses: actions/checkout@v3 |
83 | - uses: actions/setup-python@v4 | |
84 | with: | |
85 | python-version: "3.10" | |
86 | - uses: conda-incubator/setup-miniconda@v2 | |
87 | with: | |
a6858cda | 88 | miniforge-variant: Mambaforge |
89 | use-mamba: true | |
90 | channels: conda-forge | |
91 | auto-update-conda: true | |
29cb20bd | 92 | activate-environment: "" |
a6858cda | 93 | auto-activate-base: false |
29cb20bd SS |
94 | - name: Install Requirements |
95 | run: | | |
a6858cda | 96 | sudo apt-get -y install zip pandoc man sed |
29cb20bd | 97 | python -m pip install -U pip setuptools wheel |
a6858cda | 98 | python -m pip install -U Pyinstaller -r requirements.txt |
99 | reqs=$(mktemp) | |
100 | echo -e 'python=3.10.*\npyinstaller' >$reqs | |
101 | sed 's/^brotli.*/brotli-python/' <requirements.txt >>$reqs | |
102 | mamba create -n build --file $reqs | |
b5899f4f | 103 | |
29cb20bd SS |
104 | - name: Prepare |
105 | run: | | |
106 | python devscripts/update-version.py -c ${{ inputs.channel }} ${{ inputs.version }} | |
b5899f4f | 107 | python devscripts/make_lazy_extractors.py |
29cb20bd SS |
108 | - name: Build Unix platform-independent binary |
109 | run: | | |
b5899f4f | 110 | make all tar |
29cb20bd SS |
111 | - name: Build Unix standalone binary |
112 | shell: bash -l {0} | |
113 | run: | | |
a6858cda | 114 | unset LD_LIBRARY_PATH # Harmful; set by setup-python |
115 | conda activate build | |
e4afcfde | 116 | python pyinst.py --onedir |
117 | (cd ./dist/yt-dlp_linux && zip -r ../yt-dlp_linux.zip .) | |
118 | python pyinst.py | |
29cb20bd SS |
119 | mv ./dist/yt-dlp_linux ./yt-dlp_linux |
120 | mv ./dist/yt-dlp_linux.zip ./yt-dlp_linux.zip | |
121 | ||
122 | - name: Upload artifacts | |
123 | uses: actions/upload-artifact@v3 | |
124 | with: | |
125 | path: | | |
126 | yt-dlp | |
127 | yt-dlp.tar.gz | |
128 | yt-dlp_linux | |
129 | yt-dlp_linux.zip | |
130 | ||
131 | linux_arm: | |
132 | if: inputs.linux_arm | |
17fc3dc4 | 133 | permissions: |
29cb20bd SS |
134 | contents: read |
135 | packages: write # for creating cache | |
17fc3dc4 | 136 | runs-on: ubuntu-latest |
17fc3dc4 M |
137 | strategy: |
138 | matrix: | |
139 | architecture: | |
29cb20bd SS |
140 | - armv7 |
141 | - aarch64 | |
17fc3dc4 M |
142 | |
143 | steps: | |
29cb20bd SS |
144 | - uses: actions/checkout@v3 |
145 | with: | |
146 | path: ./repo | |
147 | - name: Virtualized Install, Prepare & Build | |
148 | uses: yt-dlp/run-on-arch-action@v2 | |
149 | with: | |
150 | # Ref: https://github.com/uraimo/run-on-arch-action/issues/55 | |
151 | env: | | |
152 | GITHUB_WORKFLOW: build | |
153 | githubToken: ${{ github.token }} # To cache image | |
154 | arch: ${{ matrix.architecture }} | |
155 | distro: ubuntu18.04 # Standalone executable should be built on minimum supported OS | |
156 | dockerRunArgs: --volume "${PWD}/repo:/repo" | |
157 | install: | # Installing Python 3.10 from the Deadsnakes repo raises errors | |
158 | apt update | |
159 | apt -y install zlib1g-dev python3.8 python3.8-dev python3.8-distutils python3-pip | |
160 | python3.8 -m pip install -U pip setuptools wheel | |
161 | # Cannot access requirements.txt from the repo directory at this stage | |
162 | python3.8 -m pip install -U Pyinstaller mutagen pycryptodomex websockets brotli certifi | |
163 | ||
164 | run: | | |
165 | cd repo | |
166 | python3.8 -m pip install -U Pyinstaller -r requirements.txt # Cached version may be out of date | |
167 | python3.8 devscripts/update-version.py -c ${{ inputs.channel }} ${{ inputs.version }} | |
168 | python3.8 devscripts/make_lazy_extractors.py | |
169 | python3.8 pyinst.py | |
170 | ||
171 | - name: Upload artifacts | |
172 | uses: actions/upload-artifact@v3 | |
173 | with: | |
174 | path: | # run-on-arch-action designates armv7l as armv7 | |
175 | repo/dist/yt-dlp_linux_${{ (matrix.architecture == 'armv7' && 'armv7l') || matrix.architecture }} | |
176 | ||
177 | macos: | |
178 | if: inputs.macos | |
0e5927ee | 179 | runs-on: macos-11 |
0e5927ee R |
180 | |
181 | steps: | |
29cb20bd SS |
182 | - uses: actions/checkout@v3 |
183 | # NB: In order to create a universal2 application, the version of python3 in /usr/bin has to be used | |
184 | - name: Install Requirements | |
185 | run: | | |
0e5927ee | 186 | brew install coreutils |
b5899f4f | 187 | /usr/bin/python3 -m pip install -U --user pip Pyinstaller -r requirements.txt |
188 | ||
29cb20bd SS |
189 | - name: Prepare |
190 | run: | | |
191 | /usr/bin/python3 devscripts/update-version.py -c ${{ inputs.channel }} ${{ inputs.version }} | |
b5899f4f | 192 | /usr/bin/python3 devscripts/make_lazy_extractors.py |
29cb20bd SS |
193 | - name: Build |
194 | run: | | |
b5899f4f | 195 | /usr/bin/python3 pyinst.py --target-architecture universal2 --onedir |
196 | (cd ./dist/yt-dlp_macos && zip -r ../yt-dlp_macos.zip .) | |
197 | /usr/bin/python3 pyinst.py --target-architecture universal2 | |
b5899f4f | 198 | |
29cb20bd SS |
199 | - name: Upload artifacts |
200 | uses: actions/upload-artifact@v3 | |
201 | with: | |
202 | path: | | |
203 | dist/yt-dlp_macos | |
204 | dist/yt-dlp_macos.zip | |
b5899f4f | 205 | |
29cb20bd SS |
206 | macos_legacy: |
207 | if: inputs.macos_legacy | |
6d916fe7 | 208 | runs-on: macos-latest |
28cdb605 | 209 | |
6d916fe7 | 210 | steps: |
29cb20bd SS |
211 | - uses: actions/checkout@v3 |
212 | - name: Install Python | |
213 | # We need the official Python, because the GA ones only support newer macOS versions | |
214 | env: | |
215 | PYTHON_VERSION: 3.10.5 | |
216 | MACOSX_DEPLOYMENT_TARGET: 10.9 # Used up by the Python build tools | |
217 | run: | | |
6d916fe7 SL |
218 | # Hack to get the latest patch version. Uncomment if needed |
219 | #brew install python@3.10 | |
220 | #export PYTHON_VERSION=$( $(brew --prefix)/opt/python@3.10/bin/python3 --version | cut -d ' ' -f 2 ) | |
221 | curl https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-macos11.pkg -o "python.pkg" | |
222 | sudo installer -pkg python.pkg -target / | |
223 | python3 --version | |
29cb20bd SS |
224 | - name: Install Requirements |
225 | run: | | |
6d916fe7 SL |
226 | brew install coreutils |
227 | python3 -m pip install -U --user pip Pyinstaller -r requirements.txt | |
228 | ||
29cb20bd SS |
229 | - name: Prepare |
230 | run: | | |
231 | python3 devscripts/update-version.py -c ${{ inputs.channel }} ${{ inputs.version }} | |
6d916fe7 | 232 | python3 devscripts/make_lazy_extractors.py |
29cb20bd SS |
233 | - name: Build |
234 | run: | | |
6d916fe7 | 235 | python3 pyinst.py |
c4b6c5c7 | 236 | mv dist/yt-dlp_macos dist/yt-dlp_macos_legacy |
6d916fe7 | 237 | |
29cb20bd SS |
238 | - name: Upload artifacts |
239 | uses: actions/upload-artifact@v3 | |
240 | with: | |
241 | path: | | |
242 | dist/yt-dlp_macos_legacy | |
6d916fe7 | 243 | |
29cb20bd SS |
244 | windows: |
245 | if: inputs.windows | |
915f2a92 | 246 | runs-on: windows-latest |
47930b73 | 247 | |
915f2a92 | 248 | steps: |
29cb20bd SS |
249 | - uses: actions/checkout@v3 |
250 | - uses: actions/setup-python@v4 | |
251 | with: # 3.8 is used for Win7 support | |
252 | python-version: "3.8" | |
253 | - name: Install Requirements | |
254 | run: | # Custom pyinstaller built with https://github.com/yt-dlp/pyinstaller-builds | |
17fc3dc4 | 255 | python -m pip install -U pip setuptools wheel py2exe |
365b9006 | 256 | pip install -U "https://yt-dlp.github.io/Pyinstaller-Builds/x86_64/pyinstaller-5.8.0-py3-none-any.whl" -r requirements.txt |
b5899f4f | 257 | |
29cb20bd SS |
258 | - name: Prepare |
259 | run: | | |
260 | python devscripts/update-version.py -c ${{ inputs.channel }} ${{ inputs.version }} | |
b5899f4f | 261 | python devscripts/make_lazy_extractors.py |
29cb20bd SS |
262 | - name: Build |
263 | run: | | |
b5899f4f | 264 | python setup.py py2exe |
265 | Move-Item ./dist/yt-dlp.exe ./dist/yt-dlp_min.exe | |
266 | python pyinst.py | |
267 | python pyinst.py --onedir | |
268 | Compress-Archive -Path ./dist/yt-dlp/* -DestinationPath ./dist/yt-dlp_win.zip | |
c4b6c5c7 | 269 | |
29cb20bd SS |
270 | - name: Upload artifacts |
271 | uses: actions/upload-artifact@v3 | |
272 | with: | |
273 | path: | | |
274 | dist/yt-dlp.exe | |
275 | dist/yt-dlp_min.exe | |
276 | dist/yt-dlp_win.zip | |
386cdfdb | 277 | |
29cb20bd SS |
278 | windows32: |
279 | if: inputs.windows32 | |
915f2a92 | 280 | runs-on: windows-latest |
47930b73 | 281 | |
915f2a92 | 282 | steps: |
29cb20bd SS |
283 | - uses: actions/checkout@v3 |
284 | - uses: actions/setup-python@v4 | |
285 | with: # 3.7 is used for Vista support. See https://github.com/yt-dlp/yt-dlp/issues/390 | |
286 | python-version: "3.7" | |
287 | architecture: "x86" | |
288 | - name: Install Requirements | |
289 | run: | | |
17fc3dc4 | 290 | python -m pip install -U pip setuptools wheel |
365b9006 | 291 | pip install -U "https://yt-dlp.github.io/Pyinstaller-Builds/i686/pyinstaller-5.8.0-py3-none-any.whl" -r requirements.txt |
b5899f4f | 292 | |
29cb20bd SS |
293 | - name: Prepare |
294 | run: | | |
295 | python devscripts/update-version.py -c ${{ inputs.channel }} ${{ inputs.version }} | |
b5899f4f | 296 | python devscripts/make_lazy_extractors.py |
29cb20bd SS |
297 | - name: Build |
298 | run: | | |
b5899f4f | 299 | python pyinst.py |
b5899f4f | 300 | |
29cb20bd SS |
301 | - name: Upload artifacts |
302 | uses: actions/upload-artifact@v3 | |
303 | with: | |
304 | path: | | |
305 | dist/yt-dlp_x86.exe | |
306 | ||
307 | meta_files: | |
308 | if: inputs.meta_files && always() | |
309 | needs: | |
310 | - unix | |
311 | - linux_arm | |
312 | - macos | |
313 | - macos_legacy | |
314 | - windows | |
315 | - windows32 | |
14b17a55 | 316 | runs-on: ubuntu-latest |
14b17a55 | 317 | steps: |
29cb20bd | 318 | - uses: actions/download-artifact@v3 |
b1f94422 | 319 | |
29cb20bd SS |
320 | - name: Make SHA2-SUMS files |
321 | run: | | |
322 | cd ./artifact/ | |
323 | sha256sum * > ../SHA2-256SUMS | |
324 | sha512sum * > ../SHA2-512SUMS | |
c4b6c5c7 | 325 | |
29cb20bd SS |
326 | - name: Make Update spec |
327 | run: | | |
328 | cat >> _update_spec << EOF | |
329 | # This file is used for regulating self-update | |
330 | lock 2022.08.18.36 .+ Python 3.6 | |
331 | EOF | |
332 | ||
333 | - name: Upload artifacts | |
334 | uses: actions/upload-artifact@v3 | |
335 | with: | |
336 | path: | | |
337 | SHA*SUMS* | |
338 | _update_spec |