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