Build App #65
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build App | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| os: | |
| type: choice | |
| description: OS to build on. Ubuntu is faster, MacOS supports iOS builds | |
| options: | |
| - macos-26 | |
| - ubuntu-latest | |
| platform: | |
| type: choice | |
| description: Platform to build for | |
| options: | |
| - android | |
| - ios | |
| profile: | |
| type: choice | |
| description: Build profile to use | |
| options: | |
| - development | |
| - preview | |
| - production | |
| action: | |
| type: choice | |
| description: What to do with the built app | |
| options: | |
| - none | |
| - submit | |
| - file | |
| required: true | |
| default: none | |
| jobs: | |
| build: | |
| runs-on: ${{ github.event.inputs.os }} | |
| strategy: | |
| matrix: | |
| node: [20.x] | |
| steps: | |
| - name: 🏗 Setup repo | |
| uses: actions/checkout@v4 | |
| - name: 🏗 Setup Node | |
| uses: actions/[email protected] | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: 'npm' | |
| - name: 🏗 Setup Expo and EAS | |
| uses: expo/expo-github-action@v7 | |
| with: | |
| token: ${{ secrets.EXPO_TOKEN }} | |
| expo-version: latest | |
| eas-version: latest | |
| - name: 📦 Install dependencies | |
| run: npm install | |
| - name: 🔍 Validate EAS configuration | |
| run: | | |
| echo "EAS configuration:" | |
| cat eas.json | |
| echo "Validating configuration..." | |
| eas build:configure --platform ${{ github.event.inputs.platform }} | |
| - name: 👷 Prebuild | |
| run: npx expo prebuild | |
| - name: 👷 Build app | |
| run: | | |
| eas build --local \ | |
| --non-interactive \ | |
| --platform=${{ github.event.inputs.platform }} \ | |
| --profile=${{ github.event.inputs.profile }} | |
| env: | |
| EAS_SKIP_AUTO_FINGERPRINT: 1 | |
| - name: 📁 List build output | |
| run: | | |
| echo "Searching for build artifacts in common locations:" | |
| echo "1. Checking ./app-build directory:" | |
| ls -la ./app-build/ 2>/dev/null || echo "app-build directory not found" | |
| echo "2. Checking android/app/build/outputs:" | |
| find android/app/build/outputs -type f -name "*.apk" -o -name "*.aab" 2>/dev/null || echo "No Android build files found" | |
| echo "3. Checking ios/build:" | |
| find ios/build -type f -name "*.ipa" -o -name "*.app" 2>/dev/null || echo "No iOS build files found" | |
| echo "4. Searching entire workspace for build artifacts:" | |
| find . -type f \( -name "*.apk" -o -name "*.aab" -o -name "*.ipa" -o -name "*.app" \) 2>/dev/null | head -10 | |
| - name: 🚢 Submit to App Store | |
| if: ${{ github.event.inputs.action == 'submit' }} | |
| run: | | |
| # Find the build file | |
| if [ "${{ github.event.inputs.platform }}" = "android" ]; then | |
| BUILD_FILE=$(find . -name "build-*.apk" -o -name "build-*.aab" | head -1) | |
| else | |
| BUILD_FILE=$(find . -name "build-*.ipa" -o -name "build-*.app" | head -1) | |
| fi | |
| if [ -n "$BUILD_FILE" ]; then | |
| echo "Submitting file: $BUILD_FILE" | |
| eas submit -p ${{ github.event.inputs.platform }} --profile ${{ github.event.inputs.profile }} --path "$BUILD_FILE" | |
| else | |
| echo "No build file found to submit" | |
| exit 1 | |
| fi | |
| - name: 📤 Upload Build Artifacts | |
| if: ${{ github.event.inputs.action == 'file' }} | |
| run: | | |
| # Find and upload the build file | |
| if [ "${{ github.event.inputs.platform }}" = "android" ]; then | |
| BUILD_FILE=$(find . -name "build-*.apk" -o -name "build-*.aab" | head -1) | |
| else | |
| BUILD_FILE=$(find . -name "build-*.ipa" -o -name "build-*.app" | head -1) | |
| fi | |
| if [ -n "$BUILD_FILE" ]; then | |
| echo "Uploading file: $BUILD_FILE" | |
| # Create a temporary directory and copy the file | |
| mkdir -p temp-upload | |
| cp "$BUILD_FILE" temp-upload/ | |
| # Upload using the upload-artifact action | |
| echo "::set-output name=file_path::temp-upload/$BUILD_FILE" | |
| else | |
| echo "No build file found to upload" | |
| exit 1 | |
| fi | |
| id: find-build-file | |
| - name: 📤 Upload Build Artifacts | |
| if: ${{ github.event.inputs.action == 'file' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ github.event.inputs.platform }}-${{ github.event.inputs.profile }}-build | |
| path: temp-upload/ | |
| retention-days: 30 | |
| if-no-files-found: warn |