]>
Commit | Line | Data |
---|---|---|
915f2a92 | 1 | name: Build |
75b725a7 | 2 | on: workflow_dispatch |
915f2a92 U |
3 | |
4 | jobs: | |
c4b6c5c7 | 5 | prepare: |
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 }} |
c4b6c5c7 | 10 | head_sha: ${{ steps.push_release.outputs.head_sha }} |
915f2a92 | 11 | steps: |
c4b6c5c7 | 12 | - uses: actions/checkout@v3 |
4c88ff87 | 13 | with: |
14 | fetch-depth: 0 | |
c4b6c5c7 | 15 | - uses: actions/setup-python@v4 |
915f2a92 | 16 | with: |
b5899f4f | 17 | python-version: '3.10' |
18 | ||
75b725a7 | 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") | |
915f2a92 U |
25 | - name: Bump version |
26 | id: bump_version | |
4c88ff87 | 27 | run: | |
75b725a7 | 28 | python devscripts/update-version.py ${{ steps.version_suffix.outputs.version_suffix }} |
4c88ff87 | 29 | make issuetemplates |
b5899f4f | 30 | |
75b725a7 | 31 | - name: Push to release |
885fe351 | 32 | id: push_release |
4c88ff87 | 33 | run: | |
75b725a7 | 34 | git config --global user.name github-actions |
35 | git config --global user.email github-actions@example.com | |
4c88ff87 | 36 | git add -u |
b5899f4f | 37 | git commit -m "[version] update" -m "Created by: ${{ github.event.sender.login }}" -m ":ci skip all :ci run dl" |
75b725a7 | 38 | git push origin --force ${{ github.event.ref }}:release |
4c88ff87 | 39 | echo ::set-output name=head_sha::$(git rev-parse HEAD) |
75b725a7 | 40 | - name: Update master |
75b725a7 | 41 | env: |
42 | PUSH_VERSION_COMMIT: ${{ secrets.PUSH_VERSION_COMMIT }} | |
43 | if: "env.PUSH_VERSION_COMMIT != ''" | |
44 | run: git push origin ${{ github.event.ref }} | |
b5899f4f | 45 | |
46 | ||
47 | build_unix: | |
c4b6c5c7 | 48 | needs: prepare |
e4afcfde | 49 | runs-on: ubuntu-18.04 # Standalone executable should be built on minimum supported OS |
b5899f4f | 50 | |
51 | steps: | |
c4b6c5c7 | 52 | - uses: actions/checkout@v3 |
53 | - uses: actions/setup-python@v4 | |
b5899f4f | 54 | with: |
55 | python-version: '3.10' | |
56 | - name: Install Requirements | |
57 | run: | | |
58 | sudo apt-get -y install zip pandoc man | |
59 | python -m pip install --upgrade pip setuptools wheel twine | |
60 | python -m pip install Pyinstaller -r requirements.txt | |
61 | ||
62 | - name: Prepare | |
63 | run: | | |
c4b6c5c7 | 64 | python devscripts/update-version.py ${{ needs.prepare.outputs.version_suffix }} |
b5899f4f | 65 | python devscripts/make_lazy_extractors.py |
e4afcfde | 66 | - name: Build Unix executables |
b5899f4f | 67 | run: | |
68 | make all tar | |
e4afcfde | 69 | python pyinst.py --onedir |
70 | (cd ./dist/yt-dlp_linux && zip -r ../yt-dlp_linux.zip .) | |
71 | python pyinst.py | |
b5899f4f | 72 | - name: Get SHA2-SUMS |
73 | id: get_sha | |
74 | run: | | |
c4b6c5c7 | 75 | |
76 | - name: Upload artifacts | |
77 | uses: actions/upload-artifact@v3 | |
e4afcfde | 78 | with: |
c4b6c5c7 | 79 | path: | |
80 | yt-dlp | |
81 | yt-dlp.tar.gz | |
82 | dist/yt-dlp_linux | |
83 | dist/yt-dlp_linux.zip | |
915f2a92 | 84 | |
b5899f4f | 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/* | |
70b23409 | 92 | python devscripts/set-variant.py pip -M "You installed yt-dlp with pip or using the wheel from PyPi; Use that to update" |
b5899f4f | 93 | python setup.py sdist bdist_wheel |
94 | twine upload dist/* | |
95 | ||
96 | - name: Install SSH private key for Homebrew | |
97 | env: | |
98 | BREW_TOKEN: ${{ secrets.BREW_TOKEN }} | |
99 | if: "env.BREW_TOKEN != ''" | |
100 | uses: yt-dlp/ssh-agent@v0.5.3 | |
101 | with: | |
102 | ssh-private-key: ${{ env.BREW_TOKEN }} | |
103 | - name: Update Homebrew Formulae | |
104 | env: | |
105 | BREW_TOKEN: ${{ secrets.BREW_TOKEN }} | |
106 | if: "env.BREW_TOKEN != ''" | |
107 | run: | | |
108 | git clone git@github.com:yt-dlp/homebrew-taps taps/ | |
c4b6c5c7 | 109 | python devscripts/update-formulae.py taps/Formula/yt-dlp.rb "${{ needs.prepare.outputs.ytdlp_version }}" |
b5899f4f | 110 | git -C taps/ config user.name github-actions |
111 | git -C taps/ config user.email github-actions@example.com | |
c4b6c5c7 | 112 | git -C taps/ commit -am 'yt-dlp: ${{ needs.prepare.outputs.ytdlp_version }}' |
b5899f4f | 113 | git -C taps/ push |
114 | ||
115 | ||
0e5927ee R |
116 | build_macos: |
117 | runs-on: macos-11 | |
c4b6c5c7 | 118 | needs: prepare |
0e5927ee R |
119 | |
120 | steps: | |
c4b6c5c7 | 121 | - uses: actions/checkout@v3 |
b5899f4f | 122 | # NB: In order to create a universal2 application, the version of python3 in /usr/bin has to be used |
0e5927ee R |
123 | - name: Install Requirements |
124 | run: | | |
125 | brew install coreutils | |
b5899f4f | 126 | /usr/bin/python3 -m pip install -U --user pip Pyinstaller -r requirements.txt |
127 | ||
128 | - name: Prepare | |
129 | run: | | |
c4b6c5c7 | 130 | /usr/bin/python3 devscripts/update-version.py ${{ needs.prepare.outputs.version_suffix }} |
b5899f4f | 131 | /usr/bin/python3 devscripts/make_lazy_extractors.py |
132 | - name: Build | |
133 | run: | | |
134 | /usr/bin/python3 pyinst.py --target-architecture universal2 --onedir | |
135 | (cd ./dist/yt-dlp_macos && zip -r ../yt-dlp_macos.zip .) | |
136 | /usr/bin/python3 pyinst.py --target-architecture universal2 | |
b5899f4f | 137 | |
c4b6c5c7 | 138 | - name: Upload artifacts |
139 | uses: actions/upload-artifact@v3 | |
0e5927ee | 140 | with: |
c4b6c5c7 | 141 | path: | |
142 | dist/yt-dlp_macos | |
143 | dist/yt-dlp_macos.zip | |
b5899f4f | 144 | |
0e5927ee | 145 | |
6d916fe7 SL |
146 | build_macos_legacy: |
147 | runs-on: macos-latest | |
c4b6c5c7 | 148 | needs: prepare |
28cdb605 | 149 | |
6d916fe7 | 150 | steps: |
c4b6c5c7 | 151 | - uses: actions/checkout@v3 |
6d916fe7 SL |
152 | - name: Install Python |
153 | # We need the official Python, because the GA ones only support newer macOS versions | |
154 | env: | |
155 | PYTHON_VERSION: 3.10.5 | |
156 | MACOSX_DEPLOYMENT_TARGET: 10.9 # Used up by the Python build tools | |
157 | run: | | |
158 | # Hack to get the latest patch version. Uncomment if needed | |
159 | #brew install python@3.10 | |
160 | #export PYTHON_VERSION=$( $(brew --prefix)/opt/python@3.10/bin/python3 --version | cut -d ' ' -f 2 ) | |
161 | curl https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-macos11.pkg -o "python.pkg" | |
162 | sudo installer -pkg python.pkg -target / | |
163 | python3 --version | |
164 | - name: Install Requirements | |
165 | run: | | |
166 | brew install coreutils | |
167 | python3 -m pip install -U --user pip Pyinstaller -r requirements.txt | |
168 | ||
169 | - name: Prepare | |
170 | run: | | |
c4b6c5c7 | 171 | python3 devscripts/update-version.py ${{ needs.prepare.outputs.version_suffix }} |
6d916fe7 SL |
172 | python3 devscripts/make_lazy_extractors.py |
173 | - name: Build | |
174 | run: | | |
175 | python3 pyinst.py | |
c4b6c5c7 | 176 | mv dist/yt-dlp_macos dist/yt-dlp_macos_legacy |
6d916fe7 | 177 | |
c4b6c5c7 | 178 | - name: Upload artifacts |
179 | uses: actions/upload-artifact@v3 | |
6d916fe7 | 180 | with: |
c4b6c5c7 | 181 | path: | |
182 | dist/yt-dlp_macos_legacy | |
6d916fe7 SL |
183 | |
184 | ||
7e8772bf | 185 | build_windows: |
915f2a92 | 186 | runs-on: windows-latest |
c4b6c5c7 | 187 | needs: prepare |
47930b73 | 188 | |
915f2a92 | 189 | steps: |
c4b6c5c7 | 190 | - uses: actions/checkout@v3 |
191 | - uses: actions/setup-python@v4 | |
b5899f4f | 192 | with: # 3.8 is used for Win7 support |
da8fb75d | 193 | python-version: '3.8' |
915f2a92 | 194 | - name: Install Requirements |
b5899f4f | 195 | run: | # Custom pyinstaller built with https://github.com/yt-dlp/pyinstaller-builds |
386cdfdb | 196 | python -m pip install --upgrade pip setuptools wheel py2exe |
8ef5af19 | 197 | pip install "https://yt-dlp.github.io/Pyinstaller-Builds/x86_64/pyinstaller-5.2-py3-none-any.whl" -r requirements.txt |
b5899f4f | 198 | |
199 | - name: Prepare | |
200 | run: | | |
c4b6c5c7 | 201 | python devscripts/update-version.py ${{ needs.prepare.outputs.version_suffix }} |
b5899f4f | 202 | python devscripts/make_lazy_extractors.py |
203 | - name: Build | |
204 | run: | | |
205 | python setup.py py2exe | |
206 | Move-Item ./dist/yt-dlp.exe ./dist/yt-dlp_min.exe | |
207 | python pyinst.py | |
208 | python pyinst.py --onedir | |
209 | Compress-Archive -Path ./dist/yt-dlp/* -DestinationPath ./dist/yt-dlp_win.zip | |
c4b6c5c7 | 210 | |
211 | - name: Upload artifacts | |
212 | uses: actions/upload-artifact@v3 | |
4c88ff87 | 213 | with: |
c4b6c5c7 | 214 | path: | |
215 | dist/yt-dlp.exe | |
216 | dist/yt-dlp_min.exe | |
217 | dist/yt-dlp_win.zip | |
b5899f4f | 218 | |
386cdfdb | 219 | |
915f2a92 | 220 | build_windows32: |
915f2a92 | 221 | runs-on: windows-latest |
c4b6c5c7 | 222 | needs: prepare |
47930b73 | 223 | |
915f2a92 | 224 | steps: |
c4b6c5c7 | 225 | - uses: actions/checkout@v3 |
226 | - uses: actions/setup-python@v4 | |
b5899f4f | 227 | with: # 3.7 is used for Vista support. See https://github.com/yt-dlp/yt-dlp/issues/390 |
0181adef | 228 | python-version: '3.7' |
915f2a92 | 229 | architecture: 'x86' |
0181adef | 230 | - name: Install Requirements |
0e5927ee R |
231 | run: | |
232 | python -m pip install --upgrade pip setuptools wheel | |
8ef5af19 | 233 | pip install "https://yt-dlp.github.io/Pyinstaller-Builds/i686/pyinstaller-5.2-py3-none-any.whl" -r requirements.txt |
b5899f4f | 234 | |
235 | - name: Prepare | |
236 | run: | | |
c4b6c5c7 | 237 | python devscripts/update-version.py ${{ needs.prepare.outputs.version_suffix }} |
b5899f4f | 238 | python devscripts/make_lazy_extractors.py |
239 | - name: Build | |
240 | run: | | |
241 | python pyinst.py | |
b5899f4f | 242 | |
c4b6c5c7 | 243 | - name: Upload artifacts |
244 | uses: actions/upload-artifact@v3 | |
915f2a92 | 245 | with: |
c4b6c5c7 | 246 | path: | |
247 | dist/yt-dlp_x86.exe | |
b5899f4f | 248 | |
14b17a55 | 249 | |
c4b6c5c7 | 250 | publish_release: |
14b17a55 | 251 | runs-on: ubuntu-latest |
c4b6c5c7 | 252 | needs: [prepare, build_unix, build_windows, build_windows32, build_macos, build_macos_legacy] |
14b17a55 | 253 | |
254 | steps: | |
c4b6c5c7 | 255 | - uses: actions/checkout@v3 |
256 | - uses: actions/download-artifact@v3 | |
c2c8921b | 257 | |
c4b6c5c7 | 258 | - name: Get Changelog |
259 | run: | | |
81e01959 | 260 | changelog=$(grep -oPz '(?s)(?<=### ${{ needs.prepare.outputs.ytdlp_version }}\n{2}).+?(?=\n{2,3}###)' Changelog.md) || true |
c4b6c5c7 | 261 | echo "changelog<<EOF" >> $GITHUB_ENV |
262 | echo "$changelog" >> $GITHUB_ENV | |
263 | echo "EOF" >> $GITHUB_ENV | |
b1f94422 | 264 | - name: Make Update spec |
265 | run: | | |
266 | echo "# This file is used for regulating self-update" >> _update_spec | |
135f05ef | 267 | echo "lock 2022.07.18 .+ Python 3.6" >> _update_spec |
c4b6c5c7 | 268 | - name: Make SHA2-SUMS files |
269 | run: | | |
270 | sha256sum artifact/yt-dlp | awk '{print $1 " yt-dlp"}' >> SHA2-256SUMS | |
271 | sha256sum artifact/yt-dlp.tar.gz | awk '{print $1 " yt-dlp.tar.gz"}' >> SHA2-256SUMS | |
272 | sha256sum artifact/yt-dlp.exe | awk '{print $1 " yt-dlp.exe"}' >> SHA2-256SUMS | |
273 | sha256sum artifact/yt-dlp_win.zip | awk '{print $1 " yt-dlp_win.zip"}' >> SHA2-256SUMS | |
274 | sha256sum artifact/yt-dlp_min.exe | awk '{print $1 " yt-dlp_min.exe"}' >> SHA2-256SUMS | |
275 | sha256sum artifact/yt-dlp_x86.exe | awk '{print $1 " yt-dlp_x86.exe"}' >> SHA2-256SUMS | |
276 | sha256sum artifact/yt-dlp_macos | awk '{print $1 " yt-dlp_macos"}' >> SHA2-256SUMS | |
277 | sha256sum artifact/yt-dlp_macos.zip | awk '{print $1 " yt-dlp_macos.zip"}' >> SHA2-256SUMS | |
278 | sha256sum artifact/yt-dlp_macos_legacy | awk '{print $1 " yt-dlp_macos_legacy"}' >> SHA2-256SUMS | |
279 | sha256sum artifact/dist/yt-dlp_linux | awk '{print $1 " yt-dlp_linux"}' >> SHA2-256SUMS | |
280 | sha256sum artifact/dist/yt-dlp_linux.zip | awk '{print $1 " yt-dlp_linux.zip"}' >> SHA2-256SUMS | |
281 | sha512sum artifact/yt-dlp | awk '{print $1 " yt-dlp"}' >> SHA2-512SUMS | |
282 | sha512sum artifact/yt-dlp.tar.gz | awk '{print $1 " yt-dlp.tar.gz"}' >> SHA2-512SUMS | |
283 | sha512sum artifact/yt-dlp.exe | awk '{print $1 " yt-dlp.exe"}' >> SHA2-512SUMS | |
284 | sha512sum artifact/yt-dlp_win.zip | awk '{print $1 " yt-dlp_win.zip"}' >> SHA2-512SUMS | |
285 | sha512sum artifact/yt-dlp_min.exe | awk '{print $1 " yt-dlp_min.exe"}' >> SHA2-512SUMS | |
286 | sha512sum artifact/yt-dlp_x86.exe | awk '{print $1 " yt-dlp_x86.exe"}' >> SHA2-512SUMS | |
287 | sha512sum artifact/yt-dlp_macos | awk '{print $1 " yt-dlp_macos"}' >> SHA2-512SUMS | |
288 | sha512sum artifact/yt-dlp_macos.zip | awk '{print $1 " yt-dlp_macos.zip"}' >> SHA2-512SUMS | |
289 | sha512sum artifact/yt-dlp_macos_legacy | awk '{print $1 " yt-dlp_macos_legacy"}' >> SHA2-512SUMS | |
290 | sha512sum artifact/dist/yt-dlp_linux | awk '{print $1 " yt-dlp_linux"}' >> SHA2-512SUMS | |
291 | sha512sum artifact/dist/yt-dlp_linux.zip | awk '{print $1 " yt-dlp_linux.zip"}' >> SHA2-512SUMS | |
292 | ||
293 | - name: Publish Release | |
294 | uses: yt-dlp/action-gh-release@v1 | |
b1f94422 | 295 | with: |
c4b6c5c7 | 296 | tag_name: ${{ needs.prepare.outputs.ytdlp_version }} |
297 | name: yt-dlp ${{ needs.prepare.outputs.ytdlp_version }} | |
298 | target_commitish: ${{ needs.prepare.outputs.head_sha }} | |
299 | body: | | |
300 | #### [A description of the various files]((https://github.com/yt-dlp/yt-dlp#release-files)) are in the README | |
b1f94422 | 301 | |
c4b6c5c7 | 302 | --- |
303 | <details open><summary><h3>Changelog</summary> | |
304 | <p> | |
305 | ||
306 | ${{ env.changelog }} | |
307 | ||
308 | </p> | |
309 | </details> | |
310 | files: | | |
311 | SHA2-256SUMS | |
312 | SHA2-512SUMS | |
313 | artifact/yt-dlp | |
314 | artifact/yt-dlp.tar.gz | |
315 | artifact/yt-dlp.exe | |
316 | artifact/yt-dlp_win.zip | |
317 | artifact/yt-dlp_min.exe | |
318 | artifact/yt-dlp_x86.exe | |
319 | artifact/yt-dlp_macos | |
320 | artifact/yt-dlp_macos.zip | |
321 | artifact/yt-dlp_macos_legacy | |
322 | artifact/dist/yt-dlp_linux | |
323 | artifact/dist/yt-dlp_linux.zip | |
324 | _update_spec |