From 5521e1f5bf10180c53c84594c538d157f869dfb6 Mon Sep 17 00:00:00 2001 From: aricloverEXTRA <157071384+aricloverEXTRA@users.noreply.github.com> Date: Sun, 5 Jul 2026 18:27:08 -0500 Subject: [PATCH] Improve YouTube IPA preparation and build process Refactor YouTube IPA preparation and build steps, including error handling and environment variable management. --- .github/workflows/buildapp.yml | 41 ++++++++++++++++------------------ 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/.github/workflows/buildapp.yml b/.github/workflows/buildapp.yml index d883d38..5e8a5f5 100644 --- a/.github/workflows/buildapp.yml +++ b/.github/workflows/buildapp.yml @@ -93,7 +93,7 @@ jobs: path: theos/sdks/ key: iOS-${{ inputs.sdk_version }}-SDK - - name: Download iOS SDK + - name: Download iOS SDK (if cache miss) if: steps.SDK.outputs.cache-hit != 'true' run: | git clone --quiet -n --depth=1 --filter=tree:0 https://github.com/aricloverALT/sdks/ sdks @@ -137,17 +137,18 @@ jobs: git clone --quiet --depth=1 https://code.videolan.org/videolan/dav1d.git $THEOS/vendor/dav1d git clone --quiet --depth=1 https://chromium.googlesource.com/webm/libvpx $THEOS/vendor/libvpx git clone --quiet --depth=1 https://github.com/PoomSmart/YTUHD.git YTUHD - - - name: Hash YT ipa url - run: | - URL_YT="$(jq -r '.inputs.decrypted_youtube_url' $GITHUB_EVENT_PATH)" - echo ::add-mask::$URL_YT - echo URL_YT=$URL_YT >> $GITHUB_ENV + env: + THEOS: ${{ github.workspace }}/theos - name: Prepare YouTube iPA id: prepare_youtube run: | - wget "$YOUTUBE_URL" --quiet -O main/YouTube.ipa + set -e + if [ -z "${{ github.event.inputs.decrypted_youtube_url }}" ]; then + echo "No decrypted_youtube_url provided" + exit 1 + fi + wget "${{ github.event.inputs.decrypted_youtube_url }}" --quiet -O main/YouTube.ipa cd main mv YouTube.ipa YouTube.zip unzip -q YouTube.zip @@ -155,28 +156,25 @@ jobs: echo "YT_VERSION=$youtube_version" >> $GITHUB_ENV echo "youtube_version=${youtube_version}" >> $GITHUB_OUTPUT - env: - YOUTUBE_URL: ${{ env.URL_YT }} - - name: Fix compiling & Build Package id: build_package run: | + set -e cd main - # Update Makefile - sed -i '' "s/^BUNDLE_ID .*/BUNDLE_ID = ${{ inputs.bundle_id }}/" Makefile || echo "BUNDLE_ID = ${{ inputs.bundle_id }}" >> Makefile - sed -i '' "s/^DISPLAY_NAME .*/DISPLAY_NAME = ${{ inputs.app_name }}/" Makefile || echo "DISPLAY_NAME = ${{ inputs.app_name }}" >> Makefile - sed -i '' "s/^export TARGET .*/export TARGET = iphone:clang:${{ inputs.sdk_version }}:16.0/" Makefile || echo "export TARGET = iphone:clang:${{ inputs.sdk_version }}:16.0" >> Makefile - - # YTUHD flag + # Use portable replacements on macOS runner; if sed replace fails, append fallback lines. + perl -0777 -pe "s/^BUNDLE_ID\s*=.*$/BUNDLE_ID = ${{ inputs.bundle_id }}/m" -i Makefile || echo "BUNDLE_ID = ${{ inputs.bundle_id }}" >> Makefile + perl -0777 -pe "s/^DISPLAY_NAME\s*=.*$/DISPLAY_NAME = ${{ inputs.app_name }}/m" -i Makefile || echo "DISPLAY_NAME = ${{ inputs.app_name }}" >> Makefile + perl -0777 -pe "s/^export TARGET\s*=.*$/export TARGET = iphone:clang:${{ inputs.sdk_version }}:16.0/m" -i Makefile || echo "export TARGET = iphone:clang:${{ inputs.sdk_version }}:16.0" >> Makefile + if [ "${{ inputs.ytuhd }}" = "true" ]; then - echo "YTUHD_ENABLED=1" >> Makefile + grep -q '^YTUHD_ENABLED=1' Makefile || echo "YTUHD_ENABLED=1" >> Makefile else - echo "YTUHD_ENABLED=0" >> Makefile + grep -q '^YTUHD_ENABLED=0' Makefile || echo "YTUHD_ENABLED=0" >> Makefile fi - + + # Export the SDK override to the Makefile build environment make package THEOS_PACKAGE_SCHEME=rootless IPA=Payload/YouTube.app FINALPACKAGE=1 echo "package=$(ls -t packages | head -n1)" >> $GITHUB_OUTPUT - env: THEOS: ${{ github.workspace }}/theos @@ -193,7 +191,6 @@ jobs: PARENT_BUNDLE="${{ inputs.bundle_id }}" for appex in *.appex; do if [ -f "$appex/Info.plist" ]; then - # Set extension ID to parent + .Extension (common pattern) EXT_ID="${PARENT_BUNDLE}.Extension" /usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier $EXT_ID" "$appex/Info.plist" 2>/dev/null || true echo "Set extension ID: $EXT_ID"