From 456fd8291b7467a26263981f489566c3fadf3428 Mon Sep 17 00:00:00 2001 From: Savsis Date: Wed, 6 May 2026 00:52:31 +0500 Subject: [PATCH] Update main.yml --- .github/workflows/main.yml | 115 ++++++++++++++----------------------- 1 file changed, 44 insertions(+), 71 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 73fd3d4..f7ce8a7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,89 +20,63 @@ jobs: - name: Install dependencies run: | - npm install --legacy-peer-deps --ignore-scripts - npm install react-native-svg expo-updates --legacy-peer-deps --ignore-scripts + npm install --legacy-peer-deps + npm install react-native-svg --legacy-peer-deps - - name: Force Fix JSX Syntax (Player.tsx) + - name: Hardcode Track Player Plugin run: | - # Используем Python для более умной замены, чтобы не плодить вложенные фрагменты - python3 -c " - import os - path = 'components/Player.tsx' - if os.path.exists(path): - with open(path, 'r') as f: - content = f.read() - - # Убираем возможные кривые фрагменты из прошлого билда - content = content.replace('<>', '') - - # Находим блок с таймингами и оборачиваем его ОДИН РАЗ - old_block = '{fmt(progress)}\n {fmt(duration)}' - new_block = '<>\n {fmt(progress)}\n {fmt(duration)}\n ' - - if old_block in content: - content = content.replace(old_block, new_block) - else: - # Запасной вариант, если отступы другие - content = content.replace('{fmt(progress)}', '{fmt(progress)}').replace('{fmt(progress)}', '<>{fmt(progress)}') - content = content.replace('{fmt(duration)}', '{fmt(duration)}') - - with open(path, 'w') as f: - f.write(content) - " + # 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 - - name: Prepare app.json - run: | - cat << 'EOF' > app.json - { - "expo": { - "name": "BurmaldaMusic", - "slug": "nodeshiftmusicburmalda", - "version": "1.0.0", - "ios": { - "bundleIdentifier": "com.nodeshift.burmaldamusic", - "supportsTablet": true - }, - "plugins": ["react-native-track-player"] - } - } - EOF - - - name: Patch Track Player Plugin - run: | + # 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'); + 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 - - - name: Manual JS Bundle - run: | - mkdir -p ios/BurmaldaMusic - npx react-native bundle \ - --entry-file index.js \ - --platform ios \ - --dev false \ - --bundle-output ios/BurmaldaMusic/main.jsbundle \ - --assets-dest ios/BurmaldaMusic + env: + EXPO_NO_DOTENV: 1 - name: Install CocoaPods - run: cd ios && pod install --repo-update && cd .. + run: | + # Это создаст .xcworkspace, который нужен Xcode + 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) - export NODE_BINARY=$(which node) + + echo "Building: $WORKSPACE_PATH with scheme: $SCHEME_NAME" xcodebuild build \ -workspace "$WORKSPACE_PATH" \ @@ -110,23 +84,22 @@ jobs: -configuration Release \ -sdk iphoneos \ -derivedDataPath "$RUNNER_TEMP/DerivedData" \ - CODE_SIGNING_REQUIRED=NO \ - CODE_SIGNING_ALLOWED=NO \ CODE_SIGN_IDENTITY="" \ - ENABLE_BITCODE=NO \ - SKIP_BUNDLING=YES \ - | xcpretty + CODE_SIGNING_REQUIRED=NO \ + CODE_SIGNING_ALLOWED=NO - name: Package IPA run: | - APP_PATH=$(find "$RUNNER_TEMP/DerivedData" -name "*.app" -type d | grep -v "xctest" | head -1) - if [ -z "$APP_PATH" ]; then exit 1; fi + # Собираем .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 "$APP_PATH" Payload/ - zip -qr burmalda_final.ipa Payload + zip -qr burmalda-unsigned.ipa Payload - name: Upload IPA uses: actions/upload-artifact@v4 with: - name: Burmalda-IPA - path: burmalda_final.ipa + name: burmalda-unsigned-ipa + path: burmalda-unsigned.ipa + retention-days: 1