diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c504533..f7ce8a7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: NodeShiftMusic iOS Build +name: Build iOS IPA on: push: @@ -6,8 +6,7 @@ on: workflow_dispatch: jobs: - build-ipa: - name: Build Unsigned IPA + build: runs-on: macos-latest steps: @@ -18,72 +17,89 @@ jobs: uses: actions/setup-node@v4 with: node-version: '20' - cache: 'npm' - name: Install dependencies - run: npm install --legacy-peer-deps - - - name: Fix PNG assets (jimp compat) run: | - echo "Re-encoding PNGs to strip unsupported filter types..." - find assets -name "*.png" | while read f; do - sips -s format png "$f" --out "$f" 2>/dev/null && echo " fixed: $f" || echo " skip: $f" - done + npm install --legacy-peer-deps + npm install react-native-svg --legacy-peer-deps + + - name: Hardcode Track Player Plugin + run: | + # 1. Фиксим пути модулей внутри библиотеки + TARGET_DIR="node_modules/react-native-track-player/lib/src" + if [ -d "$TARGET_DIR" ]; then + cp "$TARGET_DIR/trackPlayer" "$TARGET_DIR/trackPlayer.js" 2>/dev/null || true + fi + + # 2. Переписываем сломанный плагин на чистый CommonJS + PLUGIN_PATH="node_modules/react-native-track-player/app.plugin.js" + cat << 'EOF' > "$PLUGIN_PATH" + const { withInfoPlist } = require('@expo/config-plugins'); + module.exports = function(config) { + return withInfoPlist(config, (config) => { + if (!config.modResults.UIBackgroundModes) { + config.modResults.UIBackgroundModes = []; + } + if (!config.modResults.UIBackgroundModes.includes('audio')) { + config.modResults.UIBackgroundModes.push('audio'); + } + return config; + }); + }; + EOF + + - name: Fix Git state + run: | + git config --global user.email "bot@example.com" + git config --global user.name "Builder Bot" + git add . + git commit -m "ci: patch track player and prepare assets" || true + + - name: Fix Corrupted PNG Assets + run: | + # Исправляем PNG, чтобы сборщик не падал на "Unrecognised filter type" + find . -type f -iname "*.png" -exec sips -s format png {} --out {} \; - name: Expo prebuild + run: npx expo prebuild --platform ios --clean --no-install env: - EXPO_NO_DOTENV: - run: npx expo prebuild --platform ios --clean + EXPO_NO_DOTENV: 1 - - name: Install Pods - working-directory: ios - run: pod install --repo-update - - - name: Find workspace & scheme - id: xcode + - name: Install CocoaPods run: | - WS=$(find ios -name "*.xcworkspace" -maxdepth 2 | head -1) - SCHEME=$(basename "$WS" .xcworkspace) - echo "workspace=$WS" >> $GITHUB_OUTPUT - echo "scheme=$SCHEME" >> $GITHUB_OUTPUT - echo "Workspace: $WS | Scheme: $SCHEME" + # Это создаст .xcworkspace, который нужен Xcode + cd ios && pod install --repo-update && cd .. - - name: Build unsigned archive + - name: Build unsigned app run: | - xcodebuild archive \ - -workspace "${{ steps.xcode.outputs.workspace }}" \ - -scheme "${{ steps.xcode.outputs.scheme }}" \ + # Автоматический поиск воркспейса и схемы + WORKSPACE_PATH=$(find ios -maxdepth 1 -name "*.xcworkspace" | head -1) + SCHEME_NAME=$(basename "$WORKSPACE_PATH" .xcworkspace) + + echo "Building: $WORKSPACE_PATH with scheme: $SCHEME_NAME" + + xcodebuild build \ + -workspace "$WORKSPACE_PATH" \ + -scheme "$SCHEME_NAME" \ -configuration Release \ -sdk iphoneos \ - -archivePath "$RUNNER_TEMP/NodeShiftMusic.xcarchive" \ - CODE_SIGNING_REQUIRED=NO \ + -derivedDataPath "$RUNNER_TEMP/DerivedData" \ CODE_SIGN_IDENTITY="" \ - CODE_SIGNING_ALLOWED=NO \ - ENABLE_BITCODE=NO \ - 2>&1 | xcpretty || true + CODE_SIGNING_REQUIRED=NO \ + CODE_SIGNING_ALLOWED=NO - name: Package IPA run: | - APPS="$RUNNER_TEMP/NodeShiftMusic.xcarchive/Products/Applications" + # Собираем .app в .ipa + APP_PATH=$(find "$RUNNER_TEMP/DerivedData/Build/Products" -name "*.app" -type d | grep -v "\.xctest" | head -1) + if [ -z "$APP_PATH" ]; then echo "Error: .app not found"; exit 1; fi mkdir -p Payload - cp -r "$APPS/"*.app Payload/ - zip -qr NodeShiftMusic-unsigned.ipa Payload - rm -rf Payload - echo "IPA size: $(du -sh NodeShiftMusic-unsigned.ipa | cut -f1)" + cp -r "$APP_PATH" Payload/ + zip -qr burmalda-unsigned.ipa Payload - name: Upload IPA uses: actions/upload-artifact@v4 with: - name: NodeShiftMusic-unsigned - path: NodeShiftMusic-unsigned.ipa - retention-days: 90 - - - name: Summary - run: | - echo "## NodeShiftMusic Build" >> $GITHUB_STEP_SUMMARY - echo "Branch: \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY - echo "Commit: \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY - if [ -f NodeShiftMusic-unsigned.ipa ]; then - echo "IPA: $(du -sh NodeShiftMusic-unsigned.ipa | cut -f1)" >> $GITHUB_STEP_SUMMARY - echo "Скачай из раздела Artifacts этого run'а" >> $GITHUB_STEP_SUMMARY - fi + name: burmalda-unsigned-ipa + path: burmalda-unsigned.ipa + retention-days: 1