Files
self/app
jayssj11 c269e66f10 Feat/push to dev main (#767)
* feat: add version management system with build number tracking

- Add version.json to track iOS/Android build numbers separately
- Create version.cjs script for build number management
- Add Fastlane version_manager.rb helper
- Keep npm version for semver, version.json for build tracking

* feat: integrate version.json with Fastlane deployment process

## What Changed
- Updated iOS and Android Fastlane lanes to use version.json for build number management
- Added automatic build number increment on deployment
- Added deployment timestamp tracking

## How It Works

### iOS Deployment
1. Reads current build number from version.json
2. Increments iOS build number (e.g., 148 → 149)
3. Updates Xcode project with new build number via increment_build_number
4. Proceeds with TestFlight deployment
5. Updates lastDeployed timestamp on successful upload

### Android Deployment
1. Reads current build number from version.json
2. Increments Android build number (e.g., 82 → 83)
3. Updates build.gradle with new version code via increment_version_code
4. Proceeds with Play Store deployment
5. Updates lastDeployed timestamp on successful upload

## Why This Change
- Eliminates manual version/build number entry
- Prevents version conflicts between deployments
- Provides single source of truth for build numbers
- Enables automatic deployments without human intervention
- Tracks deployment history with timestamps

## Dependencies
- Requires version.json file (already created in previous commit)
- Uses existing Fastlane plugins:
  - increment_build_number (iOS - built-in)
  - increment_version_code (Android - from plugin)
- Version numbers still managed by npm version command

* feat: enhance deploy confirmation with version.json info

* fix: use ENV variable directly in increment_build_number to avoid secret masking

* fix: correct xcodeproj path for GitHub Actions workflow

* feat: add test mode to workflow for safe testing

- Skip store uploads when test_mode is true
- Test version bumps and builds without deployment
- Prevent accidental pushes to TestFlight/Play Store

* fix: use gradle_file_path instead of gradle_file for increment_version_code

* fix: use gsub to remove ../ prefix for CI compatibility

* chore: remove accidentally committed files

- Remove .cursor/mcp.json
- Remove .cursorignore
- Remove deployment-automation-summary.md
- Remove deployment-meeting-questions.md
- Remove pipeline.md

* feat: auto-commit version.json after successful deployment

- Commits version.json changes back to repository
- Only runs when test_mode is false
- Uses [skip ci] to prevent infinite loops
- Checks for actual changes before committing

* feat : update package.json in build step using npm version

* feat: add comprehensive caching to mobile deployment workflow

- Add caching for Yarn dependencies, Ruby gems, CocoaPods, Gradle, and Android NDK
- Implement cache versioning strategy for easy cache invalidation
- Fix cache order: caches now restored after checkout but before dependency installation
- Update mobile-setup action to skip installs when dependencies are cached
- Add cache size monitoring to track usage against GitHub's 10GB limit
- Fix Slack notification bug: skip notifications in test_mode
- Add detailed logging for package.json version updates (show from/to versions)

Expected performance improvement: ~50% faster builds (from ~15min to ~7-10min)

* fix: move bundler config after Ruby setup in mobile-setup action

* fix: rename cache env vars to avoid Yarn conflicts

Yarn was interpreting YARN_CACHE_VERSION as its own config setting.
Prefixed all cache version env vars with GH_ to avoid conflicts.

* fix: remove bundler deployment mode to allow Gemfile updates

The deployment mode was causing bundler to fail when Gemfile
changed (nokogiri was removed). CI should be able to update
the lockfile as needed.

* feat: implement strict lock file enforcement (Option 1)

- Re-enable bundler deployment mode for strict Gemfile.lock checking
- Use yarn install --immutable for strict yarn.lock checking
- Add clear error messages when lock files are out of date
- Add pre-checks to verify lock files exist
- This ensures reproducible builds and makes caching maximally effective

When developers change dependencies, they must now:
1. Run yarn install or bundle install locally
2. Commit the updated lock files
3. CI will fail with helpful instructions if they forget

* fix: update Gemfile.lock for CI environment

Remove nokogiri from Gemfile.lock since it's excluded in CI
environments (GITHUB_ACTIONS=true). This allows the strict
lock file checks to pass in CI.

* fix: correct yarn.lock path for monorepo workspace

The project uses Yarn workspaces with yarn.lock at the repository
root, not in the app directory. Updated paths to check for yarn.lock
at workspace root and use it for cache keys.

* fix: handle both boolean and string test_mode parameter

The test_mode parameter was only checking for string 'true' but
could be passed as boolean true from command line. Now handles both
cases to ensure test mode works correctly for iOS and Android.

* fix: address code review feedback for mobile deployment workflow

- Replace jq with Node.js for version extraction (jq not available on macOS runners)
- Fix concurrent commit race condition by creating separate update-version job
- Add platform validation to version_manager.rb and version.cjs scripts
- Use POSIX-compatible single = for shell string comparisons
- Ensure single atomic commit when deploying to both platforms

* fix: formatting and linting issues

- Remove trailing spaces from workflow YAML file
- Fix prettier formatting in JavaScript files
- Add -y flag to yarn version command for non-interactive mode
- Address all lint warnings from CI

* feat: implement automated branch-based mobile deployments

- Add mobile-deploy-auto.yml workflow that triggers on PR merges to dev/main
- Update mobile-deploy.yml to support workflow_call for reusability
- Add deployment_track, version_bump, and auto_deploy parameters
- Create new Fastlane lanes (deploy_auto) for iOS and Android
- Implement smart version bumping based on PR labels (major/minor/patch)
- Add graceful error handling for Play Store permission issues
- Enhance Slack notifications with deployment track information

This enables automatic deployments when PRs are merged:
- dev branch → internal testing track
- main branch → production track
- Skip deployment with [skip-deploy] in PR or no-deploy label

* feat: add automated git tagging and release system

- Add automatic git tagging for production deployments (v2.5.5, platform-specific tags)
- Create GitHub releases with changelogs for production deployments
- Add manual release script (yarn release) for version bumping and tagging
- Implement simple changelog generation from git history
- Add comprehensive deployment documentation in .github/MOBILE_DEPLOYMENT.md
- Update app/README.md with deployment commands and workflows

This completes the release automation system requested in the ticket for
manual tagging and versioning with automated changelogs and release notes.

---------

Co-authored-by: Jayaditya Gupta <nightmare@Jayadityas-MacBook-Pro.local>
2025-07-29 12:42:39 +08:00
..
2024-01-10 10:52:10 +01:00
2025-07-29 12:42:39 +08:00
2025-07-28 18:06:45 +09:00
2025-07-29 12:42:39 +08:00
2025-07-28 10:20:57 +02:00
2025-01-06 18:54:46 +01:00
2024-10-17 19:15:58 -07:00
2025-07-11 14:07:40 +02:00
2025-07-11 14:07:40 +02:00
2025-04-21 22:10:56 +02:00
2025-06-04 11:37:32 +02:00
2025-06-23 21:47:53 -07:00
2025-07-29 12:42:39 +08:00
2025-07-29 12:42:39 +08:00
2025-07-29 12:42:39 +08:00

OpenPassport App

Requirements

Requirement Version Installation Guide
nodejs > v18 Install nodejs
ruby >= 3.1.0 Install ruby
circom Latest Install circom
snarkjs Latest Install snarkjs
watchman Latest Install watchman

Android

Requirement Version Installation Guide
Java 17 Install Java
Android Studio (Optional)* Latest Install Android Studio
Android SDK Latest See instructions for Android below
Android NDK 26.1.10909125 See instructions for Android below

* To facilitate the installation of the SDK and the NDK, and to pair with development devices with a conventient QR code, you can use Android Studio.

iOS

Requirement Version Installation Guide
Xcode Latest Install Xcode
cocoapods Latest Install cocoapods

Installation

All of the commands in this guide are run from the self/app directory

Install dependencies + build

yarn install-app

Android

Using Android Studio

In Android Studio, go to Tools > SDK Manager in the menu

Under SDK Platforms, install the platform with the highest API number

Under SDK Tools, check the Show Package Details checkbox, expand NDK (Side by side), select version 26.1.10909125 and install.

Using sdkmanager via CLI

Create a directory for the Android SDK. For example ~/android_sdk. Define the environment variable ANDROID_HOME to point that directory.

Install sdkmanager under ANDROID_HOME according to the instructions on https://developer.android.com/tools/sdkmanager

List available SDK platforms

$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --list | grep platforms

In the list of platforms, find the latest version and install it. (Replace NN with the latest version number)

$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "platforms;android-NN"

Install the NDK

$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "ndk;26.1.10909125"

Define the environment variable ANDROID_NDK to $ANDROID_HOME/ndk/26.1.10909125

Install Platform Tools, needed for the adb tool

$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install platform-tools

Add $ANDROID_HOME/platform-tools to your $PATH variable

Run the app

Android

Pair and connect to the phone

Using Android Studio

In Android Studio, use Device Manager to pair with and connect to your phone.

Using adb

In your phone's developer settings, select Wireless debugging > Pair the device using a pairing code. Using the displayed information, run

adb pair PHONE_IP:PAIRING_PORT PAIRING_CODE

To connect to the device, find the IP number and port (different port than in the pairing step) directly under Wireless debugging, and run

adb connect PHONE_IP:DEVELOPMENT_PORT

Run the app

Create the file android/local.properties specifying the SDK directory, for example:

sdk.dir=/path/to/your/android/sdk

or create it with

echo sdk.dir=$ANDROID_HOME > android/local.properties

Launch the React Native server:

yarn start

Press a to open the app on Android.

To view the Android logs, use the Logcat feature in Android Studio, or use the adb logcat command-line tool.

EDIT: to test the app on android, see this issue temporarily

iOS

⚠️ To run the app on iOS, you will need a paying Apple Developer account. Free accounts can't run apps that use NFC reading.
Contact us if you need it to contribute.

Open the ios project on Xcode and add your provisioning profile in Targets > OpenPassport > Signing and Capabilities

Then, install pods:

cd ios
pod install

And run the app in Xcode.

react-native-haptic-feedback v2.3.3

To create a successful build, "Target Membership" for the AudioToolbox.framework needs to be updated.

Pods Project > Frameworks > iOS > AudioToolbox.framework

Then click on the "+" button in the "Target Membership" box and add RNReactNativeHapticFeedback

more info

Modify the circuits

If you want to modify the circuits, you'll have to adapt a few things.

First, go to the circuit folder of the monorepo, modify the circuits and build them.

Then, upload the zipped zkeys and dat files at publicly available urls and replace the urls in app/src/utils/zkeyDownload.ts.

Adapt the input generation in common/src/utils/generateInputs.ts, and adapt and redeploy the contracts.

Android

Make sure that ANDROID_NDK is defined as per the instructions above. Then build the android native module:

./scripts/build_android_module.sh

iOS

Find your development team id and run:

export DEVELOPMENT_TEAM="<your-development-team-id>"
./scripts/build_ios_module.sh

🚀 Deployment & Release

Quick Commands

# View current version info
node scripts/version.cjs status

# Create a new release (interactive)
yarn release              # Patch release (1.0.0 → 1.0.1)
yarn release:minor        # Minor release (1.0.0 → 1.1.0)
yarn release:major        # Major release (1.0.0 → 2.0.0)

# Deploy manually (with prompts)
yarn mobile-deploy        # Deploy both platforms
yarn mobile-deploy:ios    # Deploy iOS only
yarn mobile-deploy:android # Deploy Android only

# Version management
node scripts/version.cjs bump patch    # Bump version
node scripts/version.cjs bump-build ios # Increment iOS build
node scripts/version.cjs bump-build android # Increment Android build

Automated Deployments

Deployments happen automatically when you merge PRs:

  1. Merge to dev → Deploys to internal testing
  2. Merge to main → Deploys to production

To control versions with PR labels:

  • version:major - Major version bump
  • version:minor - Minor version bump
  • version:patch - Patch version bump (default for main)
  • no-deploy - Skip deployment

See CI/CD Documentation for details.

Manual Release Process

For hotfixes or manual releases:

# 1. Create a release (bumps version, creates tag, generates changelog)
yarn release:patch

# 2. Push to remote
git push && git push --tags

# 3. Deploy via GitHub Actions (happens automatically on merge to main)

The release script will:

  • Check for uncommitted changes
  • Bump the version in package.json
  • Update iOS and Android native versions
  • Generate a changelog
  • Create a git tag
  • Optionally push everything to remote

Version Management

Versions are tracked in multiple places:

  1. package.json - Semantic version (e.g., "2.5.5")
  2. version.json - Platform build numbers:
    {
      "ios": { "build": 148 },
      "android": { "build": 82 }
    }
    
  3. Native files - Auto-synced during build:
    • iOS: Info.plist, project.pbxproj
    • Android: build.gradle

Local Testing

Android Release Build

# Build release APK
cd android && ./gradlew assembleRelease

# Or build AAB for Play Store
cd android && ./gradlew bundleRelease

# Test release build on device
yarn android --mode release

iOS Release Build

# Using Fastlane (recommended)
bundle exec fastlane ios build_local

# Or using Xcode
# 1. Open ios/OpenPassport.xcworkspace
# 2. Product → Archive
# 3. Follow the wizard

Troubleshooting Deployments

Version Already Exists

The build system auto-increments build numbers. If you get version conflicts:

# Check current versions
node scripts/version.cjs status

# Force bump build numbers
node scripts/version.cjs bump-build ios
node scripts/version.cjs bump-build android

Certificate Issues (iOS)

# Check certificate validity
bundle exec fastlane ios check_certs

# For local development, ensure you have:
# - Valid Apple Developer account
# - Certificates in Keychain
# - Correct provisioning profiles

Play Store Upload Issues

If automated upload fails, the AAB is saved locally:

  • Location: android/app/build/outputs/bundle/release/app-release.aab
  • Upload manually via Play Console

Build Optimization

The CI/CD pipeline uses extensive caching:

  • iOS builds: ~15 minutes (with cache)
  • Android builds: ~10 minutes (with cache)
  • First build: ~25 minutes (no cache)

To speed up local builds:

# Clean only what's necessary
yarn clean:build  # Clean build artifacts only
yarn clean        # Full clean (use sparingly)

# Use Fastlane for consistent builds
bundle exec fastlane ios internal_test test_mode:true
bundle exec fastlane android internal_test test_mode:true

FAQ

If you get something like this:

'std::__1::system_error: open: /openpassport/app: Operation not permitted'

You might want to try this:

watchman watch-del-all
watchman shutdown-server