Code cleanup + app automation #1
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: Android APK Build | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./app | |
| steps: | |
| - name: Setup repo | |
| uses: actions/checkout@v4 | |
| - name: Setup node | |
| uses: actions/[email protected] | |
| with: | |
| node-version: 20.x | |
| cache: 'npm' | |
| cache-dependency-path: ./app/package-lock.json | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Setup Expo | |
| uses: expo/expo-github-action@v8 | |
| with: | |
| expo-version: latest | |
| eas-version: latest | |
| token: ${{ secrets.EXPO_TOKEN }} | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Initialize EAS | |
| run: eas init --force --non-interactive | |
| - name: Build Android APK | |
| run: eas build --platform android --profile local --local --output ${{ github.workspace }}/app-release.apk --non-interactive | |
| - name: Generate release tag | |
| id: tag | |
| run: | | |
| echo "RELEASE_TAG=android-v1.0.0-$(date +'%Y%m%d-%H%M%S')" >> $GITHUB_OUTPUT | |
| echo "RELEASE_NAME=Friend Lite Android $(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_OUTPUT | |
| echo "BUILD_TIME=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.tag.outputs.RELEASE_TAG }} | |
| release_name: ${{ steps.tag.outputs.RELEASE_NAME }} | |
| body: | | |
| ## 📱 Android APK Build | |
| **Built from commit:** ${{ github.sha }} | |
| **Branch:** ${{ github.ref_name }} | |
| **Build time:** ${{ steps.tag.outputs.BUILD_TIME }} | |
| Ready to install on Android devices! | |
| draft: false | |
| prerelease: true | |
| - name: Upload Android APK to Release | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ${{ github.workspace }}/app-release.apk | |
| asset_name: friend-lite-android.apk | |
| asset_content_type: application/vnd.android.package-archive |