Android Release #7
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 }}' | base64 --decode > android/app/release.keystore | |
| if [ -f android/app/release.keystore ]; then | |
| echo "✓ Keystore decoded successfully" | |
| # Verify keystore is valid | |
| keytool -list -keystore android/app/release.keystore -storepass '${{ secrets.ANDROID_KEYSTORE_PASSWORD }}' > /dev/null 2>&1 | |
| if [ $? -eq 0 ]; then | |
| echo "✓ Keystore is valid" | |
| else | |
| echo "✗ Keystore is invalid or password is incorrect" | |
| exit 1 | |
| fi | |
| 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 | |
| echo "✓ local.properties created" | |
| echo "Key alias: ${{ secrets.ANDROID_KEY_ALIAS }}" | |
| - name: Make build script executable | |
| run: chmod +x ./scripts/build-release.sh | |
| - name: Verify signing before build | |
| run: | | |
| echo "Verifying keystore one more time before build..." | |
| keytool -list -keystore android/app/release.keystore \ | |
| -storepass '${{ secrets.ANDROID_KEYSTORE_PASSWORD }}' \ | |
| -alias '${{ secrets.ANDROID_KEY_ALIAS }}' \ | |
| -keypass '${{ secrets.ANDROID_KEY_PASSWORD }}' > /dev/null 2>&1 | |
| if [ $? -eq 0 ]; then | |
| echo "✓ Signing configuration verified" | |
| else | |
| echo "✗ Signing verification failed" | |
| exit 1 | |
| fi | |
| - 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 |