-
-
Notifications
You must be signed in to change notification settings - Fork 0
Add Android release GitHub Actions workflow and keep OAuth flow alive when app backgrounds #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
CheFu-code
merged 1 commit into
main
from
codex/fix-signing-implementation-issue-lif9ma
Jun 20, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,197 @@ | ||
| name: Android Release Build | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| architectures: | ||
| description: "Android ABIs to build" | ||
| required: false | ||
| default: "armeabi-v7a,arm64-v8a,x86,x86_64" | ||
| release_name: | ||
| description: "Release name/version" | ||
| required: false | ||
| default: "release-build" | ||
| push: | ||
| branches: | ||
| - main | ||
| - production | ||
| tags: | ||
| - 'v*' | ||
|
|
||
| concurrency: | ||
| group: android-release-build-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| build-release: | ||
| name: Build Android Release APK | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 90 | ||
|
|
||
| env: | ||
| NODE_ENV: production | ||
| EXPO_NO_TELEMETRY: "1" | ||
| SENTRY_DISABLE_AUTO_UPLOAD: "true" | ||
| GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs=-Xmx4g" | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| lfs: true | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22.13.x | ||
|
|
||
| - name: Setup Java | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: 17 | ||
|
|
||
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@v4 | ||
|
|
||
| - name: Setup Android SDK | ||
| uses: android-actions/setup-android@v3 | ||
|
|
||
| - name: Install Android packages | ||
| run: | | ||
| set -euo pipefail | ||
| packages=("platform-tools" "platforms;android-36" "build-tools;36.0.0" "ndk;27.1.12297006" "cmake;3.22.1") | ||
| for attempt in 1 2 3; do | ||
| if sdkmanager "${packages[@]}"; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| echo "Android package install failed on attempt ${attempt}; clearing partial SDK downloads before retry." | ||
| rm -rf "$ANDROID_HOME/.temp" "$ANDROID_HOME/temp" "$ANDROID_HOME/ndk/27.1.12297006" | ||
| sleep $((attempt * 10)) | ||
| done | ||
|
|
||
| sdkmanager "${packages[@]}" | ||
|
|
||
| - name: Install dependencies | ||
| run: npm install --legacy-peer-deps --include=dev | ||
|
|
||
| - name: Generate native code | ||
| run: npx expo prebuild --platform android | ||
|
|
||
| - name: Decode keystore | ||
| id: decode_keystore | ||
| run: | | ||
| mkdir -p "$GITHUB_WORKSPACE/android/app" && KEYSTORE_PATH="$GITHUB_WORKSPACE/android/app/keystore.jks" | ||
| echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > "$KEYSTORE_PATH" | ||
| test -s "$KEYSTORE_PATH" | ||
| echo "keystore_path=$KEYSTORE_PATH" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Validate Expo config | ||
| run: npx expo config --type public | ||
|
|
||
| - name: Build release APK | ||
| working-directory: android | ||
| run: | | ||
| chmod +x ./gradlew | ||
| ./gradlew "app:assembleRelease" \ | ||
| -x lint \ | ||
| -x test \ | ||
| --stacktrace \ | ||
| --console=plain \ | ||
| -PreactNativeDevServerPort=8081 \ | ||
| -PreactNativeArchitectures="${ARCHITECTURES}" \ | ||
| -Pandroid.injected.signing.store.file="${{ steps.decode_keystore.outputs.keystore_path }}" \ | ||
| -Pandroid.injected.signing.store.password="${{ secrets.KEYSTORE_PASSWORD }}" \ | ||
| -Pandroid.injected.signing.key.alias="${{ secrets.KEYSTORE_ALIAS }}" \ | ||
| -Pandroid.injected.signing.key.password="${{ secrets.KEYSTORE_KEY_PASSWORD }}" | ||
| env: | ||
| ARCHITECTURES: ${{ github.event.inputs.architectures || 'armeabi-v7a,arm64-v8a,x86,x86_64' }} | ||
|
|
||
| - name: Build release Bundle (AAB) | ||
| working-directory: android | ||
| run: | | ||
| ./gradlew "app:bundleRelease" \ | ||
| -x lint \ | ||
| -x test \ | ||
| --stacktrace \ | ||
| --console=plain \ | ||
| -PreactNativeDevServerPort=8081 \ | ||
| -Pandroid.injected.signing.store.file="${{ steps.decode_keystore.outputs.keystore_path }}" \ | ||
| -Pandroid.injected.signing.store.password="${{ secrets.KEYSTORE_PASSWORD }}" \ | ||
| -Pandroid.injected.signing.key.alias="${{ secrets.KEYSTORE_ALIAS }}" \ | ||
| -Pandroid.injected.signing.key.password="${{ secrets.KEYSTORE_KEY_PASSWORD }}" | ||
|
|
||
| - name: Generate build metadata | ||
| id: build_info | ||
| run: | | ||
| BUILD_TIME=$(date -u +'%Y-%m-%dT%H:%M:%SZ') | ||
| GIT_SHA=${{ github.sha }} | ||
| GIT_REF=${{ github.ref }} | ||
| echo "build_time=${BUILD_TIME}" >> $GITHUB_OUTPUT | ||
| echo "git_sha=${GIT_SHA:0:7}" >> $GITHUB_OUTPUT | ||
| echo "git_ref=${GIT_REF##*/}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Upload release APK | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: quantum-app-release-apk-${{ steps.build_info.outputs.git_ref }}-${{ steps.build_info.outputs.git_sha }} | ||
| path: android/app/build/outputs/apk/release/*.apk | ||
| retention-days: 30 | ||
| if-no-files-found: error | ||
|
|
||
| - name: Upload release AAB (App Bundle) | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: quantum-app-release-aab-${{ steps.build_info.outputs.git_ref }}-${{ steps.build_info.outputs.git_sha }} | ||
| path: android/app/build/outputs/bundle/release/*.aab | ||
| retention-days: 30 | ||
| if-no-files-found: error | ||
|
|
||
| - name: Generate checksums | ||
| run: | | ||
| cd android/app/build/outputs | ||
| find . -type f \( -name "*.apk" -o -name "*.aab" \) -exec sha256sum {} \; > checksums.txt | ||
| cat checksums.txt | ||
|
|
||
| - name: Upload checksums | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: quantum-app-checksums-${{ steps.build_info.outputs.git_ref }}-${{ steps.build_info.outputs.git_sha }} | ||
| path: android/app/build/outputs/checksums.txt | ||
| retention-days: 30 | ||
|
|
||
| - name: Create release notes | ||
| run: | | ||
| cat > release-notes.md << 'EOF' | ||
| # Quantum App Release Build | ||
|
|
||
| **Build Information:** | ||
| - Build Time: ${{ steps.build_info.outputs.build_time }} | ||
| - Git Reference: ${{ steps.build_info.outputs.git_ref }} | ||
| - Git SHA: ${{ steps.build_info.outputs.git_sha }} | ||
| - Architectures: ${{ github.event.inputs.architectures || 'armeabi-v7a,arm64-v8a,x86,x86_64' }} | ||
|
|
||
| **Artifacts:** | ||
| - main APK (all architectures) | ||
| - App Bundle (AAB) for Google Play Store | ||
| - SHA256 checksums | ||
|
|
||
| **Version:** ${{ github.ref_name }} | ||
| **Build by:** GitHub Actions | ||
| EOF | ||
| cat release-notes.md | ||
|
|
||
| - name: Upload release notes | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: quantum-app-release-notes-${{ steps.build_info.outputs.git_ref }}-${{ steps.build_info.outputs.git_sha }} | ||
| path: release-notes.md | ||
| retention-days: 30 | ||
|
|
||
| - name: Build summary | ||
| run: | | ||
| echo "✅ Release build completed successfully" | ||
| echo "📦 Artifacts generated:" | ||
| ls -lh android/app/build/outputs/apk/release/ 2>/dev/null || echo "No APKs found" | ||
| ls -lh android/app/build/outputs/bundle/release/ 2>/dev/null || echo "No AABs found" | ||
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a keystore password contains shell metacharacters such as
$, backticks, or quotes, substituting${{ secrets.KEYSTORE_PASSWORD }}directly into therunscript lets bash interpret those characters before Gradle receives the value, so release signing can fail with a corrupted password; the same pattern is repeated in the bundle step. Put the signing secrets inenvand pass quoted shell variables instead so the secret value is not re-expanded by the shell.Useful? React with 👍 / 👎.