name: Build iOS App on: push: branches: [main, master, develop] workflow_dispatch: inputs: profile: description: 'Build profile' required: true default: 'preview' type: choice options: - preview - production jobs: build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' - name: Install dependencies (Full Build) run: npm install - name: Validate project run: | echo "Validating project structure..." test -f app.json && echo "✓ app.json" || (echo "✗ Missing app.json" && exit 1) test -f package.json && echo "✓ package.json" || (echo "✗ Missing package.json" && exit 1) test -f eas.json && echo "✓ eas.json" || (echo "✓ eas.json will be created" && true) - name: Check TypeScript run: npx tsc --noEmit 2>&1 | head -20 || true - name: Setup Expo CLI run: npm install -g expo-cli eas-cli - name: Determine build profile id: profile run: | if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then PROFILE="${{ github.event.inputs.profile }}" elif [ "${{ github.ref }}" = "refs/heads/develop" ]; then PROFILE="preview" else PROFILE="production" fi echo "profile=$PROFILE" >> $GITHUB_OUTPUT echo "Building with profile: $PROFILE" - name: Build with EAS env: EAS_TOKEN: ${{ secrets.EAS_TOKEN }} run: | PROFILE="${{ steps.profile.outputs.profile }}" echo "🔨 Starting EAS build with profile: $PROFILE" eas build \ --platform ios \ --profile "$PROFILE" \ --non-interactive \ --wait \ 2>&1 | tee build.log - name: Extract build info if: always() run: | echo "## Build Summary" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY if grep -q "Successfully built" build.log; then echo "✅ **Status:** Success" >> $GITHUB_STEP_SUMMARY echo "📲 **Download:** [EAS Dashboard](https://expo.dev)" >> $GITHUB_STEP_SUMMARY else echo "❌ **Status:** Failed" >> $GITHUB_STEP_SUMMARY echo "📋 **Profile:** ${{ steps.profile.outputs.profile }}" >> $GITHUB_STEP_SUMMARY fi echo "" >> $GITHUB_STEP_SUMMARY echo "**Branch:** ${{ github.ref }}" >> $GITHUB_STEP_SUMMARY echo "**Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY - name: Handle build failure if: failure() run: | echo "❌ Build failed!" echo "Check logs above or visit EAS Dashboard" tail -50 build.log exit 1