From ebe3c572bb6b0543b2ae6897222e71566fda9339 Mon Sep 17 00:00:00 2001 From: Savsis Date: Fri, 8 May 2026 13:50:00 +0500 Subject: [PATCH] Update main.yml --- .github/workflows/main.yml | 112 ++++++++++++++++++++++--------------- 1 file changed, 66 insertions(+), 46 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f7ce8a7..033644a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,61 +23,65 @@ jobs: npm install --legacy-peer-deps npm install react-native-svg --legacy-peer-deps - - name: Hardcode Track Player Plugin + - name: Patch Track Player 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 + # 1. Create missing trackPlayer.js so original plugin import doesn't crash + node scripts/patch-track-player.js - # 2. Переписываем сломанный плагин на чистый CommonJS + # 2. Also rewrite app.plugin.js to pure CommonJS as safety fallback 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 +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 + echo "Track player patched OK" - - 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 + # 3. Add plugin back to app.json so AppDelegate gets audio mode set + node -e " + const fs = require('fs'); + const cfg = JSON.parse(fs.readFileSync('app.json', 'utf8')); + const plugins = cfg.expo.plugins || []; + if (!plugins.includes('react-native-track-player')) { + plugins.unshift('react-native-track-player'); + cfg.expo.plugins = plugins; + fs.writeFileSync('app.json', JSON.stringify(cfg, null, 2)); + console.log('Added plugin to app.json'); + } else { + console.log('Plugin already in app.json'); + } + " - - name: Fix Corrupted PNG Assets + - name: Fix PNG assets run: | - # Исправляем PNG, чтобы сборщик не падал на "Unrecognised filter type" - find . -type f -iname "*.png" -exec sips -s format png {} --out {} \; + find . -type f -iname "*.png" \ + -not -path "*/node_modules/*" \ + -not -path "*/.git/*" \ + -exec sips -s format png {} --out {} \; 2>/dev/null || true - name: Expo prebuild - run: npx expo prebuild --platform ios --clean --no-install env: EXPO_NO_DOTENV: 1 + run: npx expo prebuild --platform ios --clean --no-install - - name: Install CocoaPods - run: | - # Это создаст .xcworkspace, который нужен Xcode - cd ios && pod install --repo-update && cd .. + - name: Pod install + run: cd ios && pod install --repo-update && cd .. - name: Build unsigned app run: | - # Автоматический поиск воркспейса и схемы WORKSPACE_PATH=$(find ios -maxdepth 1 -name "*.xcworkspace" | head -1) SCHEME_NAME=$(basename "$WORKSPACE_PATH" .xcworkspace) - - echo "Building: $WORKSPACE_PATH with scheme: $SCHEME_NAME" - + echo "Building: $WORKSPACE_PATH | Scheme: $SCHEME_NAME" + xcodebuild build \ -workspace "$WORKSPACE_PATH" \ -scheme "$SCHEME_NAME" \ @@ -86,20 +90,36 @@ jobs: -derivedDataPath "$RUNNER_TEMP/DerivedData" \ CODE_SIGN_IDENTITY="" \ CODE_SIGNING_REQUIRED=NO \ - CODE_SIGNING_ALLOWED=NO + CODE_SIGNING_ALLOWED=NO \ + ENABLE_BITCODE=NO - name: Package IPA run: | - # Собираем .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 + APP_PATH=$(find "$RUNNER_TEMP/DerivedData/Build/Products" \ + -name "*.app" -type d ! -name "*.xctest" | head -1) + if [ -z "$APP_PATH" ]; then + echo "ERROR: .app not found in DerivedData" + find "$RUNNER_TEMP/DerivedData" -name "*.app" -type d 2>/dev/null || true + exit 1 + fi + echo "App: $APP_PATH" mkdir -p Payload cp -r "$APP_PATH" Payload/ - zip -qr burmalda-unsigned.ipa Payload + zip -qr burmalda-v1.0.7-beta-unsigned.ipa Payload + rm -rf Payload + echo "IPA size: $(du -sh burmalda-v1.0.7-beta-unsigned.ipa | cut -f1)" - name: Upload IPA uses: actions/upload-artifact@v4 with: - name: burmalda-unsigned-ipa - path: burmalda-unsigned.ipa - retention-days: 1 + name: burmalda-v1.0.7-beta-unsigned + path: burmalda-v1.0.7-beta-unsigned.ipa + retention-days: 7 + + - name: Summary + run: | + echo "### ✅ Burmalda v1.0.7 BETA" >> $GITHUB_STEP_SUMMARY + if [ -f burmalda-v1.0.7-beta-unsigned.ipa ]; then + echo "IPA size: $(du -sh burmalda-v1.0.7-beta-unsigned.ipa | cut -f1)" >> $GITHUB_STEP_SUMMARY + fi + echo "Скачай из раздела **Artifacts** этого run'а" >> $GITHUB_STEP_SUMMARY