]>
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/* | |
92 | python setup.py sdist bdist_wheel | |
93 | twine upload dist/* | |
94 | ||
95 | - name: Install SSH private key for Homebrew | |
96 | env: | |
97 | BREW_TOKEN: ${{ secrets.BREW_TOKEN }} | |
98 | if: "env.BREW_TOKEN != ''" | |
99 | uses: yt-dlp/ssh-agent@v0.5.3 | |
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/ | |
c4b6c5c7 | 108 | python devscripts/update-formulae.py taps/Formula/yt-dlp.rb "${{ needs.prepare.outputs.ytdlp_version }}" |
b5899f4f | 109 | git -C taps/ config user.name github-actions |
110 | git -C taps/ config user.email github-actions@example.com | |
c4b6c5c7 | 111 | git -C taps/ commit -am 'yt-dlp: ${{ needs.prepare.outputs.ytdlp_version }}' |
b5899f4f | 112 | git -C taps/ push |
113 | ||
114 | ||
0e5927ee R |
115 | build_macos: |
116 | runs-on: macos-11 | |
c4b6c5c7 | 117 | needs: prepare |
0e5927ee R |
118 | |
119 | steps: | |
c4b6c5c7 | 120 | - uses: actions/checkout@v3 |
b5899f4f | 121 | # NB: In order to create a universal2 application, the version of python3 in /usr/bin has to be used |
0e5927ee R |
122 | - name: Install Requirements |
123 | run: | | |
124 | brew install coreutils | |
b5899f4f | 125 | /usr/bin/python3 -m pip install -U --user pip Pyinstaller -r requirements.txt |
126 | ||
127 | - name: Prepare | |
128 | run: | | |
c4b6c5c7 | 129 | /usr/bin/python3 devscripts/update-version.py ${{ needs.prepare.outputs.version_suffix }} |
b5899f4f | 130 | /usr/bin/python3 devscripts/make_lazy_extractors.py |
131 | - name: Build | |
132 | run: | | |
133 | /usr/bin/python3 pyinst.py --target-architecture universal2 --onedir | |
134 | (cd ./dist/yt-dlp_macos && zip -r ../yt-dlp_macos.zip .) | |
135 | /usr/bin/python3 pyinst.py --target-architecture universal2 | |
b5899f4f | 136 | |
c4b6c5c7 | 137 | - name: Upload artifacts |
138 | uses: actions/upload-artifact@v3 | |
0e5927ee | 139 | with: |
c4b6c5c7 | 140 | path: | |
141 | dist/yt-dlp_macos | |
142 | dist/yt-dlp_macos.zip | |
b5899f4f | 143 | |
0e5927ee | 144 | |
6d916fe7 SL |
145 | build_macos_legacy: |
146 | runs-on: macos-latest | |
c4b6c5c7 | 147 | needs: prepare |
28cdb605 | 148 | |
6d916fe7 | 149 | steps: |
c4b6c5c7 | 150 | - uses: actions/checkout@v3 |
6d916fe7 SL |
151 | - name: Install Python |
152 | # We need the official Python, because the GA ones only support newer macOS versions | |
153 | env: | |
154 | PYTHON_VERSION: 3.10.5 | |
155 | MACOSX_DEPLOYMENT_TARGET: 10.9 # Used up by the Python build tools | |
156 | run: | | |
157 | # Hack to get the latest patch version. Uncomment if needed | |
158 | #brew install python@3.10 | |
159 | #export PYTHON_VERSION=$( $(brew --prefix)/opt/python@3.10/bin/python3 --version | cut -d ' ' -f 2 ) | |
160 | curl https://www.python.org/ftp/python/${PYTHON_VERSION}/python-${PYTHON_VERSION}-macos11.pkg -o "python.pkg" | |
161 | sudo installer -pkg python.pkg -target / | |
162 | python3 --version | |
163 | - name: Install Requirements | |
164 | run: | | |
165 | brew install coreutils | |
166 | python3 -m pip install -U --user pip Pyinstaller -r requirements.txt | |
167 | ||
168 | - name: Prepare | |
169 | run: | | |
c4b6c5c7 | 170 | python3 devscripts/update-version.py ${{ needs.prepare.outputs.version_suffix }} |
6d916fe7 SL |
171 | python3 devscripts/make_lazy_extractors.py |
172 | - name: Build | |
173 | run: | | |
174 | python3 pyinst.py | |
c4b6c5c7 | 175 | mv dist/yt-dlp_macos dist/yt-dlp_macos_legacy |
6d916fe7 | 176 | |
c4b6c5c7 | 177 | - name: Upload artifacts |
178 | uses: actions/upload-artifact@v3 | |
6d916fe7 | 179 | with: |
c4b6c5c7 | 180 | path: | |
181 | dist/yt-dlp_macos_legacy | |
6d916fe7 SL |
182 | |
183 | ||
7e8772bf | 184 | build_windows: |
915f2a92 | 185 | runs-on: windows-latest |
c4b6c5c7 | 186 | needs: prepare |
47930b73 | 187 | |
915f2a92 | 188 | steps: |
c4b6c5c7 | 189 | - uses: actions/checkout@v3 |
190 | - uses: actions/setup-python@v4 | |
b5899f4f | 191 | with: # 3.8 is used for Win7 support |
da8fb75d | 192 | python-version: '3.8' |
915f2a92 | 193 | - name: Install Requirements |
b5899f4f | 194 | run: | # Custom pyinstaller built with https://github.com/yt-dlp/pyinstaller-builds |
386cdfdb | 195 | python -m pip install --upgrade pip setuptools wheel py2exe |
8ef5af19 | 196 | pip install "https://yt-dlp.github.io/Pyinstaller-Builds/x86_64/pyinstaller-5.2-py3-none-any.whl" -r requirements.txt |
b5899f4f | 197 | |
198 | - name: Prepare | |
199 | run: | | |
c4b6c5c7 | 200 | python devscripts/update-version.py ${{ needs.prepare.outputs.version_suffix }} |
b5899f4f | 201 | python devscripts/make_lazy_extractors.py |
202 | - name: Build | |
203 | run: | | |
204 | python setup.py py2exe | |
205 | Move-Item ./dist/yt-dlp.exe ./dist/yt-dlp_min.exe | |
206 | python pyinst.py | |
207 | python pyinst.py --onedir | |
208 | Compress-Archive -Path ./dist/yt-dlp/* -DestinationPath ./dist/yt-dlp_win.zip | |
c4b6c5c7 | 209 | |
210 | - name: Upload artifacts | |
211 | uses: actions/upload-artifact@v3 | |
4c88ff87 | 212 | with: |
c4b6c5c7 | 213 | path: | |
214 | dist/yt-dlp.exe | |
215 | dist/yt-dlp_min.exe | |
216 | dist/yt-dlp_win.zip | |
b5899f4f | 217 | |
386cdfdb | 218 | |
915f2a92 | 219 | build_windows32: |
915f2a92 | 220 | runs-on: windows-latest |
c4b6c5c7 | 221 | needs: prepare |
47930b73 | 222 | |
915f2a92 | 223 | steps: |
c4b6c5c7 | 224 | - uses: actions/checkout@v3 |
225 | - uses: actions/setup-python@v4 | |
b5899f4f | 226 | with: # 3.7 is used for Vista support. See https://github.com/yt-dlp/yt-dlp/issues/390 |
0181adef | 227 | python-version: '3.7' |
915f2a92 | 228 | architecture: 'x86' |
0181adef | 229 | - name: Install Requirements |
0e5927ee R |
230 | run: | |
231 | python -m pip install --upgrade pip setuptools wheel | |
8ef5af19 | 232 | pip install "https://yt-dlp.github.io/Pyinstaller-Builds/i686/pyinstaller-5.2-py3-none-any.whl" -r requirements.txt |
b5899f4f | 233 | |
234 | - name: Prepare | |
235 | run: | | |
c4b6c5c7 | 236 | python devscripts/update-version.py ${{ needs.prepare.outputs.version_suffix }} |
b5899f4f | 237 | python devscripts/make_lazy_extractors.py |
238 | - name: Build | |
239 | run: | | |
240 | python pyinst.py | |
b5899f4f | 241 | |
c4b6c5c7 | 242 | - name: Upload artifacts |
243 | uses: actions/upload-artifact@v3 | |
915f2a92 | 244 | with: |
c4b6c5c7 | 245 | path: | |
246 | dist/yt-dlp_x86.exe | |
b5899f4f | 247 | |
14b17a55 | 248 | |
c4b6c5c7 | 249 | publish_release: |
14b17a55 | 250 | runs-on: ubuntu-latest |
c4b6c5c7 | 251 | needs: [prepare, build_unix, build_windows, build_windows32, build_macos, build_macos_legacy] |
14b17a55 | 252 | |
253 | steps: | |
c4b6c5c7 | 254 | - uses: actions/checkout@v3 |
255 | - uses: actions/download-artifact@v3 | |
c2c8921b | 256 | |
c4b6c5c7 | 257 | - name: Get Changelog |
258 | run: | | |
259 | changelog=$(grep -oPz '(?s)(?<=### ${{ steps.bump_version.outputs.ytdlp_version }}\n{2}).+?(?=\n{2,3}###)' Changelog.md) || true | |
260 | echo "changelog<<EOF" >> $GITHUB_ENV | |
261 | echo "$changelog" >> $GITHUB_ENV | |
262 | echo "EOF" >> $GITHUB_ENV | |
b1f94422 | 263 | - name: Make Update spec |
264 | run: | | |
265 | echo "# This file is used for regulating self-update" >> _update_spec | |
135f05ef | 266 | echo "lock 2022.07.18 .+ Python 3.6" >> _update_spec |
c4b6c5c7 | 267 | - name: Make SHA2-SUMS files |
268 | run: | | |
269 | sha256sum artifact/yt-dlp | awk '{print $1 " yt-dlp"}' >> SHA2-256SUMS | |
270 | sha256sum artifact/yt-dlp.tar.gz | awk '{print $1 " yt-dlp.tar.gz"}' >> SHA2-256SUMS | |
271 | sha256sum artifact/yt-dlp.exe | awk '{print $1 " yt-dlp.exe"}' >> SHA2-256SUMS | |
272 | sha256sum artifact/yt-dlp_win.zip | awk '{print $1 " yt-dlp_win.zip"}' >> SHA2-256SUMS | |
273 | sha256sum artifact/yt-dlp_min.exe | awk '{print $1 " yt-dlp_min.exe"}' >> SHA2-256SUMS | |
274 | sha256sum artifact/yt-dlp_x86.exe | awk '{print $1 " yt-dlp_x86.exe"}' >> SHA2-256SUMS | |
275 | sha256sum artifact/yt-dlp_macos | awk '{print $1 " yt-dlp_macos"}' >> SHA2-256SUMS | |
276 | sha256sum artifact/yt-dlp_macos.zip | awk '{print $1 " yt-dlp_macos.zip"}' >> SHA2-256SUMS | |
277 | sha256sum artifact/yt-dlp_macos_legacy | awk '{print $1 " yt-dlp_macos_legacy"}' >> SHA2-256SUMS | |
278 | sha256sum artifact/dist/yt-dlp_linux | awk '{print $1 " yt-dlp_linux"}' >> SHA2-256SUMS | |
279 | sha256sum artifact/dist/yt-dlp_linux.zip | awk '{print $1 " yt-dlp_linux.zip"}' >> SHA2-256SUMS | |
280 | sha512sum artifact/yt-dlp | awk '{print $1 " yt-dlp"}' >> SHA2-512SUMS | |
281 | sha512sum artifact/yt-dlp.tar.gz | awk '{print $1 " yt-dlp.tar.gz"}' >> SHA2-512SUMS | |
282 | sha512sum artifact/yt-dlp.exe | awk '{print $1 " yt-dlp.exe"}' >> SHA2-512SUMS | |
283 | sha512sum artifact/yt-dlp_win.zip | awk '{print $1 " yt-dlp_win.zip"}' >> SHA2-512SUMS | |
284 | sha512sum artifact/yt-dlp_min.exe | awk '{print $1 " yt-dlp_min.exe"}' >> SHA2-512SUMS | |
285 | sha512sum artifact/yt-dlp_x86.exe | awk '{print $1 " yt-dlp_x86.exe"}' >> SHA2-512SUMS | |
286 | sha512sum artifact/yt-dlp_macos | awk '{print $1 " yt-dlp_macos"}' >> SHA2-512SUMS | |
287 | sha512sum artifact/yt-dlp_macos.zip | awk '{print $1 " yt-dlp_macos.zip"}' >> SHA2-512SUMS | |
288 | sha512sum artifact/yt-dlp_macos_legacy | awk '{print $1 " yt-dlp_macos_legacy"}' >> SHA2-512SUMS | |
289 | sha512sum artifact/dist/yt-dlp_linux | awk '{print $1 " yt-dlp_linux"}' >> SHA2-512SUMS | |
290 | sha512sum artifact/dist/yt-dlp_linux.zip | awk '{print $1 " yt-dlp_linux.zip"}' >> SHA2-512SUMS | |
291 | ||
292 | - name: Publish Release | |
293 | uses: yt-dlp/action-gh-release@v1 | |
b1f94422 | 294 | with: |
c4b6c5c7 | 295 | tag_name: ${{ needs.prepare.outputs.ytdlp_version }} |
296 | name: yt-dlp ${{ needs.prepare.outputs.ytdlp_version }} | |
297 | target_commitish: ${{ needs.prepare.outputs.head_sha }} | |
298 | body: | | |
299 | #### [A description of the various files]((https://github.com/yt-dlp/yt-dlp#release-files)) are in the README | |
b1f94422 | 300 | |
c4b6c5c7 | 301 | --- |
302 | <details open><summary><h3>Changelog</summary> | |
303 | <p> | |
304 | ||
305 | ${{ env.changelog }} | |
306 | ||
307 | </p> | |
308 | </details> | |
309 | files: | | |
310 | SHA2-256SUMS | |
311 | SHA2-512SUMS | |
312 | artifact/yt-dlp | |
313 | artifact/yt-dlp.tar.gz | |
314 | artifact/yt-dlp.exe | |
315 | artifact/yt-dlp_win.zip | |
316 | artifact/yt-dlp_min.exe | |
317 | artifact/yt-dlp_x86.exe | |
318 | artifact/yt-dlp_macos | |
319 | artifact/yt-dlp_macos.zip | |
320 | artifact/yt-dlp_macos_legacy | |
321 | artifact/dist/yt-dlp_linux | |
322 | artifact/dist/yt-dlp_linux.zip | |
323 | _update_spec |