Build App #435
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
| # References: | |
| # https://github.com/thomasread99/expo-workflows/ | |
| name: Build App | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| ref: | |
| type: string | |
| description: 'Ref to Build' | |
| required: true | |
| submit: | |
| type: boolean | |
| description: 'Submit?' | |
| required: false | |
| release: | |
| type: boolean | |
| description: 'Release?' | |
| required: false | |
| jobs: | |
| build-android: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| build_success: ${{ steps.build.outcome == 'success' }} | |
| steps: | |
| - name: Setup repo | |
| uses: actions/checkout@v5 | |
| with: | |
| token: ${{ secrets.USTHING_GITHUB_TOKEN }} | |
| ref: ${{ inputs.ref }} | |
| repository: USThing/USThingApp | |
| - name: Free Disk Space for Ubuntu | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| tool-cache: true | |
| android: false # Keep Android tools | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| - name: Setup Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Setup Corepack | |
| run: | | |
| corepack enable | |
| corepack install | |
| - name: Setup Yarn Cache | |
| uses: actions/setup-node@v6 | |
| with: | |
| cache: yarn | |
| - name: Setup JDK 17 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 17 | |
| distribution: microsoft | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| with: | |
| cache-read-only: ${{ github.ref != 'refs/heads/master' }} | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Setup Expo and EAS | |
| uses: expo/expo-github-action@v8 | |
| with: | |
| token: ${{ secrets.EXPO_TOKEN }} | |
| expo-version: latest | |
| eas-version: latest | |
| - name: Install Dependencies | |
| run: yarn | |
| - name: Build | |
| id: build | |
| run: eas build --profile production --platform android --local --non-interactive --output=${{ github.workspace }}/usthing.aab | |
| # https://docs.expo.dev/submit/ios/#submitting-your-app-using-ci | |
| - name: Submit to Google Play | |
| if: ${{ inputs.submit == true }} | |
| continue-on-error: ${{ inputs.release == false }} | |
| run: eas submit --profile production --platform android --non-interactive --path ${{ github.workspace }}/usthing.aab | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: usthing.aab | |
| path: ${{ github.workspace }}/usthing.aab | |
| - name: Result | |
| id: result | |
| if: ${{ always() }} | |
| run: | | |
| echo "build_success=${{ steps.build.outcome == 'success' }}" >> "$GITHUB_OUTPUT" | |
| build-ios: | |
| runs-on: macos-26 | |
| outputs: | |
| build_success: ${{ steps.build.outcome == 'success' }} | |
| steps: | |
| - name: Setup repo | |
| uses: actions/checkout@v5 | |
| with: | |
| token: ${{ secrets.USTHING_GITHUB_TOKEN }} | |
| ref: ${{ inputs.ref }} | |
| repository: USThing/USThingApp | |
| - name: Setup Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Setup Corepack | |
| run: | | |
| corepack enable | |
| corepack install | |
| - name: Setup Yarn Cache | |
| uses: actions/setup-node@v4 | |
| with: | |
| cache: yarn | |
| - name: Setup Expo | |
| uses: expo/expo-github-action@v8 | |
| with: | |
| expo-version: latest | |
| eas-version: latest | |
| token: ${{ secrets.EXPO_TOKEN }} | |
| - name: Install Dependencies | |
| run: yarn | |
| - name: Build iOS App | |
| id: build | |
| run: eas build --profile production --platform ios --local --non-interactive --output ${{ github.workspace }}/usthing.ipa | |
| # https://docs.expo.dev/submit/ios/#submitting-your-app-using-ci | |
| - name: Submit to TestFlight | |
| if: ${{ inputs.submit == true }} | |
| continue-on-error: ${{ inputs.release == false }} | |
| run: eas submit --profile production --platform ios --non-interactive --path ${{ github.workspace }}/usthing.ipa | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: usthing.ipa | |
| path: ${{ github.workspace }}/usthing.ipa | |
| - name: Result | |
| id: result | |
| if: ${{ always() }} | |
| run: | | |
| echo "build_success=${{ steps.build.outcome == 'success' }}" >> "$GITHUB_OUTPUT" | |
| build-android-apk: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| build_success: ${{ steps.build.outcome == 'success' }} | |
| steps: | |
| - name: Setup repo | |
| uses: actions/checkout@v5 | |
| with: | |
| token: ${{ secrets.USTHING_GITHUB_TOKEN }} | |
| ref: ${{ inputs.ref }} | |
| repository: USThing/USThingApp | |
| - name: Free Disk Space for Ubuntu | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| tool-cache: true | |
| android: false # Keep Android tools | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| - name: Setup Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Setup Corepack | |
| run: | | |
| corepack enable | |
| corepack install | |
| - name: Setup Yarn Cache | |
| uses: actions/setup-node@v6 | |
| with: | |
| cache: yarn | |
| - name: Setup JDK 17 | |
| uses: actions/setup-java@v5 | |
| with: | |
| java-version: 17 | |
| distribution: microsoft | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| with: | |
| cache-read-only: ${{ github.ref != 'refs/heads/master' }} | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Setup Expo and EAS | |
| uses: expo/expo-github-action@v8 | |
| with: | |
| token: ${{ secrets.EXPO_TOKEN }} | |
| expo-version: latest | |
| eas-version: latest | |
| - name: Install Dependencies | |
| run: yarn | |
| - name: Build | |
| id: build | |
| run: eas build --profile production:apk --platform android --local --non-interactive --output=${{ github.workspace }}/usthing.apk | |
| - name: Setup jq | |
| uses: dcarbone/install-jq-action@v2 | |
| - name: Submit to Production Server | |
| if: ${{ inputs.release == true }} | |
| run: | | |
| curl -X 'POST' \ | |
| 'https://static.api.usthing.xyz/v1/apk/latest' \ | |
| -H 'Authorization: Bearer ${{ secrets.ANDROID_APK_RELEASE_KEY }}' \ | |
| -H 'Content-Type: multipart/form-data' \ | |
| -F 'apkFile=@${{ github.workspace }}/usthing.apk' \ | |
| -F "apkVersion=$(jq '.expo.version' app.json)" | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: usthing.apk | |
| path: ${{ github.workspace }}/usthing.apk | |
| - name: Result | |
| id: result | |
| if: ${{ always() }} | |
| run: | | |
| echo "build_success=${{ steps.build.outcome == 'success' }}" >> "$GITHUB_OUTPUT" | |
| report-status-create: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Report Status | |
| uses: USThing/USThingAppBuilder/reporter@main | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.USTHING_GITHUB_TOKEN }} | |
| RUN_ID: ${{ github.run_id }} | |
| REPO: "USThingApp" | |
| OWNER: "USThing" | |
| SHA: ${{ inputs.ref }} | |
| BUILDING: true | |
| report-status: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build-android | |
| - build-ios | |
| - build-android-apk | |
| # Run this job even if previous jobs fail. | |
| if: ${{ always() }} | |
| steps: | |
| - name: Report Status | |
| uses: USThing/USThingAppBuilder/reporter@main | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.USTHING_GITHUB_TOKEN }} | |
| RUN_ID: ${{ github.run_id }} | |
| REPO: "USThingApp" | |
| OWNER: "USThing" | |
| SHA: ${{ inputs.ref }} | |
| BUILD_ANDROID: ${{ needs.build-android.outputs.build_success }} | |
| BUILD_IOS: ${{ needs.build-ios.outputs.build_success }} | |
| BUILD_ANDROID_APK: ${{ needs.build-android-apk.outputs.build_success }} |