nodeshiftmusicburmalda/.github/workflows/main.yml
2026-05-06 00:26:44 +05:00

132 lines
4.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: Build iOS IPA
on:
push:
branches: [main, master]
workflow_dispatch:
jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node 20
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: |
npm install --legacy-peer-deps --ignore-scripts
npm install react-native-svg expo-updates --legacy-peer-deps --ignore-scripts
- name: Force Fix JSX Syntax (Player.tsx)
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('<><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
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"
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: 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
- name: Install CocoaPods
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)
export NODE_BINARY=$(which node)
xcodebuild build \
-workspace "$WORKSPACE_PATH" \
-scheme "$SCHEME_NAME" \
-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
- 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
mkdir -p Payload
cp -r "$APP_PATH" Payload/
zip -qr burmalda_final.ipa Payload
- name: Upload IPA
uses: actions/upload-artifact@v4
with:
name: Burmalda-IPA
path: burmalda_final.ipa