- - uses: actions/checkout@v2
- - name: Set up Python
- uses: actions/setup-python@v2
- with:
- python-version: '3.8'
- - name: Install Requirements
- run: pip install pyinstaller mutagen pycryptodome
- - name: Bump version
- id: bump_version
- run: python devscripts/update-version.py
- - name: Print version
- run: echo "${{ steps.bump_version.outputs.ytdlc_version }}"
- - name: Run PyInstaller Script
- run: python pyinst.py 64
- - name: Upload youtube-dlc.exe Windows binary
- id: upload-release-windows
- uses: actions/upload-release-asset@v1
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- upload_url: ${{ needs.build_unix.outputs.upload_url }}
- asset_path: ./dist/youtube-dlc.exe
- asset_name: youtube-dlc.exe
- asset_content_type: application/vnd.microsoft.portable-executable
- - name: Get SHA2-256SUMS for youtube-dlc.exe
- id: sha2_file_win
- env:
- SHA2_win: ${{ hashFiles('dist/youtube-dlc.exe') }}
- run: echo "::set-output name=sha2_windows::$SHA2_win"
-
- build_windows32:
+ - uses: actions/checkout@v4
+ # NB: Building universal2 does not work with python from actions/setup-python
+
+ - name: Restore cached requirements
+ id: restore-cache
+ uses: actions/cache/restore@v4
+ env:
+ SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
+ with:
+ path: |
+ ~/yt-dlp-build-venv
+ key: cache-reqs-${{ github.job }}
+
+ - name: Install Requirements
+ run: |
+ brew install coreutils
+ python3 -m venv ~/yt-dlp-build-venv
+ source ~/yt-dlp-build-venv/bin/activate
+ python3 devscripts/install_deps.py -o --include build
+ python3 devscripts/install_deps.py --print --include pyinstaller > requirements.txt
+ # We need to ignore wheels otherwise we break universal2 builds
+ python3 -m pip install -U --no-binary :all: -r requirements.txt
+ # We need to fuse our own universal2 wheels for curl_cffi
+ python3 -m pip install -U delocate
+ mkdir curl_cffi_whls curl_cffi_universal2
+ python3 devscripts/install_deps.py --print -o --include curl-cffi > requirements.txt
+ for platform in "macosx_11_0_arm64" "macosx_11_0_x86_64"; do
+ python3 -m pip download \
+ --only-binary=:all: \
+ --platform "${platform}" \
+ -d curl_cffi_whls \
+ -r requirements.txt
+ done
+ ( # Overwrite x86_64-only libs with fat/universal2 libs or else Pyinstaller will do the opposite
+ # See https://github.com/yt-dlp/yt-dlp/pull/10069
+ cd curl_cffi_whls
+ mkdir -p curl_cffi/.dylibs
+ python_libdir=$(python3 -c 'import sys; from pathlib import Path; print(Path(sys.path[1]).parent)')
+ for dylib in lib{ssl,crypto}.3.dylib; do
+ cp "${python_libdir}/${dylib}" "curl_cffi/.dylibs/${dylib}"
+ for wheel in curl_cffi*macos*x86_64.whl; do
+ zip "${wheel}" "curl_cffi/.dylibs/${dylib}"
+ done
+ done
+ )
+ python3 -m delocate.cmd.delocate_fuse curl_cffi_whls/curl_cffi*.whl -w curl_cffi_universal2
+ python3 -m delocate.cmd.delocate_fuse curl_cffi_whls/cffi*.whl -w curl_cffi_universal2
+ for wheel in curl_cffi_universal2/*cffi*.whl; do
+ mv -n -- "${wheel}" "${wheel/x86_64/universal2}"
+ done
+ python3 -m pip install --force-reinstall -U curl_cffi_universal2/*cffi*.whl
+
+ - name: Prepare
+ run: |
+ python3 devscripts/update-version.py -c "${{ inputs.channel }}" -r "${{ needs.process.outputs.origin }}" "${{ inputs.version }}"
+ python3 devscripts/make_lazy_extractors.py
+ - name: Build
+ run: |
+ source ~/yt-dlp-build-venv/bin/activate
+ python3 -m bundle.pyinstaller --target-architecture universal2 --onedir
+ (cd ./dist/yt-dlp_macos && zip -r ../yt-dlp_macos.zip .)
+ python3 -m bundle.pyinstaller --target-architecture universal2
+
+ - name: Verify --update-to
+ if: vars.UPDATE_TO_VERIFICATION
+ run: |
+ chmod +x ./dist/yt-dlp_macos
+ cp ./dist/yt-dlp_macos ./dist/yt-dlp_macos_downgraded
+ version="$(./dist/yt-dlp_macos --version)"
+ ./dist/yt-dlp_macos_downgraded -v --update-to yt-dlp/yt-dlp@2023.03.04
+ downgraded_version="$(./dist/yt-dlp_macos_downgraded --version)"
+ [[ "$version" != "$downgraded_version" ]]
+
+ - name: Upload artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: build-bin-${{ github.job }}
+ path: |
+ dist/yt-dlp_macos
+ dist/yt-dlp_macos.zip
+ compression-level: 0
+
+ - name: Cleanup cache
+ if: steps.restore-cache.outputs.cache-hit == 'true'
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ cache_key: cache-reqs-${{ github.job }}
+ repository: ${{ github.repository }}
+ branch: ${{ github.ref }}
+ run: |
+ gh extension install actions/gh-actions-cache
+ gh actions-cache delete "${cache_key}" -R "${repository}" -B "${branch}" --confirm
+
+ - name: Cache requirements
+ uses: actions/cache/save@v4
+ with:
+ path: |
+ ~/yt-dlp-build-venv
+ key: cache-reqs-${{ github.job }}
+
+ macos_legacy:
+ needs: process
+ if: inputs.macos_legacy
+ runs-on: macos-12