Update main.yml
This commit is contained in:
parent
8852ba83a4
commit
456fd8291b
1 changed files with 44 additions and 71 deletions
115
.github/workflows/main.yml
vendored
115
.github/workflows/main.yml
vendored
|
|
@ -20,89 +20,63 @@ jobs:
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
npm install --legacy-peer-deps --ignore-scripts
|
npm install --legacy-peer-deps
|
||||||
npm install react-native-svg expo-updates --legacy-peer-deps --ignore-scripts
|
npm install react-native-svg --legacy-peer-deps
|
||||||
|
|
||||||
- name: Force Fix JSX Syntax (Player.tsx)
|
- name: Hardcode Track Player Plugin
|
||||||
run: |
|
run: |
|
||||||
# Используем Python для более умной замены, чтобы не плодить вложенные фрагменты
|
# 1. Фиксим пути модулей внутри библиотеки
|
||||||
python3 -c "
|
TARGET_DIR="node_modules/react-native-track-player/lib/src"
|
||||||
import os
|
if [ -d "$TARGET_DIR" ]; then
|
||||||
path = 'components/Player.tsx'
|
cp "$TARGET_DIR/trackPlayer" "$TARGET_DIR/trackPlayer.js" 2>/dev/null || true
|
||||||
if os.path.exists(path):
|
fi
|
||||||
with open(path, 'r') as f:
|
|
||||||
content = f.read()
|
|
||||||
|
|
||||||
# Убираем возможные кривые фрагменты из прошлого билда
|
|
||||||
content = content.replace('<><Text', '<Text').replace('</Text></>', '</Text>')
|
|
||||||
|
|
||||||
# Находим блок с таймингами и оборачиваем его ОДИН РАЗ
|
|
||||||
old_block = '<Text style={s.timeText}>{fmt(progress)}</Text>\n <Text style={s.timeText}>{fmt(duration)}</Text>'
|
|
||||||
new_block = '<>\n <Text style={s.timeText}>{fmt(progress)}</Text>\n <Text style={s.timeText}>{fmt(duration)}</Text>\n </>'
|
|
||||||
|
|
||||||
if old_block in content:
|
|
||||||
content = content.replace(old_block, new_block)
|
|
||||||
else:
|
|
||||||
# Запасной вариант, если отступы другие
|
|
||||||
content = content.replace('{fmt(progress)}</Text>', '{fmt(progress)}</Text>').replace('<Text style={s.timeText}>{fmt(progress)}', '<><Text style={s.timeText}>{fmt(progress)}')
|
|
||||||
content = content.replace('{fmt(duration)}</Text>', '{fmt(duration)}</Text></>')
|
|
||||||
|
|
||||||
with open(path, 'w') as f:
|
|
||||||
f.write(content)
|
|
||||||
"
|
|
||||||
|
|
||||||
- name: Prepare app.json
|
# 2. Переписываем сломанный плагин на чистый CommonJS
|
||||||
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: |
|
|
||||||
PLUGIN_PATH="node_modules/react-native-track-player/app.plugin.js"
|
PLUGIN_PATH="node_modules/react-native-track-player/app.plugin.js"
|
||||||
cat << 'EOF' > "$PLUGIN_PATH"
|
cat << 'EOF' > "$PLUGIN_PATH"
|
||||||
const { withInfoPlist } = require('@expo/config-plugins');
|
const { withInfoPlist } = require('@expo/config-plugins');
|
||||||
module.exports = function(config) {
|
module.exports = function(config) {
|
||||||
return withInfoPlist(config, (config) => {
|
return withInfoPlist(config, (config) => {
|
||||||
if (!config.modResults.UIBackgroundModes) config.modResults.UIBackgroundModes = [];
|
if (!config.modResults.UIBackgroundModes) {
|
||||||
if (!config.modResults.UIBackgroundModes.includes('audio')) config.modResults.UIBackgroundModes.push('audio');
|
config.modResults.UIBackgroundModes = [];
|
||||||
|
}
|
||||||
|
if (!config.modResults.UIBackgroundModes.includes('audio')) {
|
||||||
|
config.modResults.UIBackgroundModes.push('audio');
|
||||||
|
}
|
||||||
return config;
|
return config;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
EOF
|
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
|
- name: Expo prebuild
|
||||||
run: npx expo prebuild --platform ios --clean --no-install
|
run: npx expo prebuild --platform ios --clean --no-install
|
||||||
|
env:
|
||||||
- name: Manual JS Bundle
|
EXPO_NO_DOTENV: 1
|
||||||
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
|
|
||||||
|
|
||||||
- name: Install CocoaPods
|
- 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
|
- name: Build unsigned app
|
||||||
run: |
|
run: |
|
||||||
|
# Автоматический поиск воркспейса и схемы
|
||||||
WORKSPACE_PATH=$(find ios -maxdepth 1 -name "*.xcworkspace" | head -1)
|
WORKSPACE_PATH=$(find ios -maxdepth 1 -name "*.xcworkspace" | head -1)
|
||||||
SCHEME_NAME=$(basename "$WORKSPACE_PATH" .xcworkspace)
|
SCHEME_NAME=$(basename "$WORKSPACE_PATH" .xcworkspace)
|
||||||
export NODE_BINARY=$(which node)
|
|
||||||
|
echo "Building: $WORKSPACE_PATH with scheme: $SCHEME_NAME"
|
||||||
|
|
||||||
xcodebuild build \
|
xcodebuild build \
|
||||||
-workspace "$WORKSPACE_PATH" \
|
-workspace "$WORKSPACE_PATH" \
|
||||||
|
|
@ -110,23 +84,22 @@ jobs:
|
||||||
-configuration Release \
|
-configuration Release \
|
||||||
-sdk iphoneos \
|
-sdk iphoneos \
|
||||||
-derivedDataPath "$RUNNER_TEMP/DerivedData" \
|
-derivedDataPath "$RUNNER_TEMP/DerivedData" \
|
||||||
CODE_SIGNING_REQUIRED=NO \
|
|
||||||
CODE_SIGNING_ALLOWED=NO \
|
|
||||||
CODE_SIGN_IDENTITY="" \
|
CODE_SIGN_IDENTITY="" \
|
||||||
ENABLE_BITCODE=NO \
|
CODE_SIGNING_REQUIRED=NO \
|
||||||
SKIP_BUNDLING=YES \
|
CODE_SIGNING_ALLOWED=NO
|
||||||
| xcpretty
|
|
||||||
|
|
||||||
- name: Package IPA
|
- name: Package IPA
|
||||||
run: |
|
run: |
|
||||||
APP_PATH=$(find "$RUNNER_TEMP/DerivedData" -name "*.app" -type d | grep -v "xctest" | head -1)
|
# Собираем .app в .ipa
|
||||||
if [ -z "$APP_PATH" ]; then exit 1; fi
|
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
|
mkdir -p Payload
|
||||||
cp -r "$APP_PATH" Payload/
|
cp -r "$APP_PATH" Payload/
|
||||||
zip -qr burmalda_final.ipa Payload
|
zip -qr burmalda-unsigned.ipa Payload
|
||||||
|
|
||||||
- name: Upload IPA
|
- name: Upload IPA
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: Burmalda-IPA
|
name: burmalda-unsigned-ipa
|
||||||
path: burmalda_final.ipa
|
path: burmalda-unsigned.ipa
|
||||||
|
retention-days: 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue