Android Release #5
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 Release | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Free up disk space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| sudo docker image prune --all --force | |
| df -h | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "yarn" | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: "temurin" | |
| java-version: "17" | |
| cache: "gradle" | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Download model assets | |
| run: node -e "require('./scripts/download-models.js').ensureModelAssets()" | |
| - name: Clean up after model download | |
| run: | | |
| rm -rf ~/.npm | |
| yarn cache clean | |
| df -h | |
| - name: Create .env file | |
| run: | | |
| cat > .env << EOF | |
| EXPO_PUBLIC_DETOUR_API_KEY=${{ secrets.EXPO_PUBLIC_DETOUR_API_KEY }} | |
| EXPO_PUBLIC_DETOUR_APP_ID=${{ secrets.EXPO_PUBLIC_DETOUR_APP_ID }} | |
| EOF | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Decode keystore | |
| run: | | |
| # Decode keystore from base64 (secret is accessed directly, never echoed) | |
| echo '${{ secrets.ANDROID_KEYSTORE_BASE64 }}' | tr -d '\n\r\t ' | base64 --decode > android/app/release.keystore | |
| if [ -f android/app/release.keystore ]; then | |
| echo "✓ Keystore decoded successfully" | |
| else | |
| echo "✗ Failed to decode keystore" | |
| exit 1 | |
| fi | |
| - name: Create local.properties | |
| run: | | |
| cat > android/local.properties << EOF | |
| MYAPP_UPLOAD_STORE_FILE=release.keystore | |
| MYAPP_UPLOAD_STORE_PASSWORD=${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
| MYAPP_UPLOAD_KEY_ALIAS=${{ secrets.ANDROID_KEY_ALIAS }} | |
| MYAPP_UPLOAD_KEY_PASSWORD=${{ secrets.ANDROID_KEY_PASSWORD }} | |
| EOF | |
| - name: Make build script executable | |
| run: chmod +x ./scripts/build-release.sh | |
| - name: Build Android App Bundle | |
| run: ./scripts/build-release.sh | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-release-${{ github.run_number }}.aab | |
| path: android/app/build/outputs/bundle/release/app-release.aab | |
| retention-days: 30 | |
| - name: Clean up keystore | |
| if: always() | |
| run: rm -f android/app/release.keystore |