Building and Signing
During development, pam dev installs a debuggable app with hot reload. To
ship, you need something different: an optimized, signed artifact that a store
accepts. PAM Native produces those artifacts from the same project with a few
commands:
| Command | Produces |
|---|---|
pam build --release |
An optimized Android APK in dist/ |
pam package |
A signed Android App Bundle (.aab) and universal APK in dist/ |
pam ios:package |
A signed iOS .ipa in dist/ (macOS with Xcode) |
pam release --platform … |
Doctor, plugin certification, then the packages above |
PAM never creates, stores, or uploads signing credentials. Keystores, passwords, certificates, and provisioning profiles stay in your environment or CI secrets, and upload to the stores stays in your hands.
Versioning
Section titled “Versioning”Every release needs a new version. Set both numbers in pam-native.json:
{ "versionCode": 12, "versionName": "1.4.0"}| Key | Android | iOS | Rules |
|---|---|---|---|
versionCode |
versionCode |
CFBundleVersion |
A positive integer. Increase it for every upload; stores reject a number they have already seen. |
versionName |
versionName |
CFBundleShortVersionString |
The version users see, up to 64 bytes. |
versionName is also part of every artifact file name, so each release lands
in dist/ under its own name.
Build types
Section titled “Build types”| Build | Command | Optimized | Signed with | Application ID |
|---|---|---|---|---|
| Debug | pam dev, pam run, pam build |
No | Debug key | <applicationId>.debug |
| Benchmark | pam build --benchmark, pam run --release |
Yes (R8, non-debuggable) | Debug key | <applicationId> plus android.benchmarkApplicationIdSuffix |
| Release | pam build --release, pam package |
Yes (R8 and resource shrinking) | Your release key | <applicationId> |
The debug suffix can be changed with android.debugApplicationIdSuffix. When
Firebase Messaging is configured for debug builds, the debug app keeps the
base application ID so it matches your google-services.json.
Use the benchmark build to test release performance on a device without your release keystore. See Performance.
Android ABIs
Section titled “Android ABIs”Android builds include native code for each CPU architecture (ABI). By default
pam build and pam package include all four supported ABIs: arm64-v8a,
armeabi-v7a, x86, and x86_64. pam run and pam dev build only the ABI
of the connected device.
Pass --abi (repeatable) to build a subset:
pam build --release --abi arm64-v8a --abi x86_64For store uploads, keep the default: Google Play delivers only the matching ABI from an App Bundle to each device, so users do not download the others.
Audit before you sign
Section titled “Audit before you sign”Every permission, deep link, share target, entitlement, extension, and native dependency your app and its plugins declare becomes part of the signed app. Review them before each release:
pam audit --deny-highThe audit lists findings by severity: info, warning, high, and
critical. By default only critical findings fail the command;
--deny-high also fails on high findings. Add --json to save a
machine-readable report for CI:
pam audit --deny-high --json > artifacts/mobile-release-audit.jsonTypical findings:
| Severity | Examples |
|---|---|
| Critical | Broad Android permissions (MANAGE_EXTERNAL_STORAGE, REQUEST_INSTALL_PACKAGES, QUERY_ALL_PACKAGES, SYSTEM_ALERT_WINDOW); unpinned Swift package branches |
| High | Camera, microphone, location, contacts, calendar, SMS, health, media library, and nearby-device permissions; iOS entitlements merged by a plugin; dependencies that can change without a manifest change |
| Warning | Other platform permissions, verified deep links, share targets |
| Info | INTERNET and network-state permissions, unverified deep links |
A high finding is not necessarily wrong. A camera app needs the camera. The point is that each one is a deliberate choice backed by a shipped feature.
Android
Section titled “Android”Create an upload keystore
Section titled “Create an upload keystore”Create the keystore once with the JDK’s keytool and keep it outside the
project. If you lose it, you cannot publish updates signed with the same key.
keytool -genkeypair -v \ -keystore ~/keys/acme-release.jks \ -alias release \ -keyalg RSA -keysize 2048 -validity 10000Configure signing
Section titled “Configure signing”PAM reads the signing configuration only from four environment variables:
| Variable | Value |
|---|---|
PAM_ANDROID_KEYSTORE |
Path to the .jks or .keystore file. The file must exist. |
PAM_ANDROID_KEY_ALIAS |
The key alias. |
PAM_ANDROID_KEYSTORE_PASSWORD |
The keystore password. |
PAM_ANDROID_KEY_PASSWORD |
The key password. |
export PAM_ANDROID_KEYSTORE=~/keys/acme-release.jksexport PAM_ANDROID_KEY_ALIAS=releaseexport PAM_ANDROID_KEYSTORE_PASSWORD='…'export PAM_ANDROID_KEY_PASSWORD='…'
pam signpam sign checks the configuration without building. It names any missing
variable and exits with status 1, which makes it a good first step in CI.
Package
Section titled “Package”pam packagepam package refuses to run without a valid signing configuration. With the
app named Acme and versionName 1.4.0, it writes:
dist/├── acme-1.4.0-android.aab # Upload this to Google Play├── acme-1.4.0-android.aab.sha256├── acme-1.4.0-android.apk # Universal APK for QA and direct distribution├── acme-1.4.0-android.apk.sha256└── android-release.jsonandroid-release.json records the application ID, version code and name, PHP
runtime, and artifact names, so CI and store upload steps can read them
instead of guessing:
{ "schemaVersion": 1, "platform": 1, "applicationId": "com.example.acme", "versionCode": 12, "versionName": "1.4.0", "runtime": "8.5", "artifacts": [ "acme-1.4.0-android.aab", "acme-1.4.0-android.apk" ]}pam build --release produces only the APK
(dist/acme-1.4.0-android-release.apk). It is signed when the four variables
are set and unsigned otherwise.
iOS packaging requires macOS with Xcode. PAM generates a self-contained Xcode
host in .pam-native/ios/App and archives it with xcodebuild.
Configure signing
Section titled “Configure signing”| Variable | Value |
|---|---|
PAM_IOS_DEVELOPMENT_TEAM |
Your 10-character Apple Developer team ID. |
PAM_IOS_EXPORT_OPTIONS_PLIST |
Path to an ExportOptions.plist that describes the export. The file must exist. |
The export options file is a standard Xcode file. For App Store Connect uploads it typically looks like this:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict> <key>method</key> <string>app-store-connect</string> <key>teamID</key> <string>ABCDE12345</string> <key>signingStyle</key> <string>automatic</string></dict></plist>Older Xcode versions use app-store as the method name. Run
xcodebuild -help on your Mac to see the export options it supports.
export PAM_IOS_DEVELOPMENT_TEAM=ABCDE12345export PAM_IOS_EXPORT_OPTIONS_PLIST=~/keys/ExportOptions.plist
pam ios:signPackage
Section titled “Package”pam ios:packageThe command archives a Release build for generic/platform=iOS, exports it
with your options file, and writes dist/acme-1.4.0-ios.ipa with its
.sha256. It passes -allowProvisioningUpdates, so with automatic signing
Xcode can create or refresh profiles for the team signed in to Xcode (or
authorized in your CI keychain).
The .ipa file name uses an ASCII form of the app name: accents are
transliterated so that App Store Connect accepts the bundle.
One-command releases
Section titled “One-command releases”pam release runs the PAM Native doctor and plugin certification, then
packages the requested platform. It stops at the first failure:
pam release --platform androidpam release --platform ios
# macOS only: both platformspam release --platform allWithout --platform, it packages Android on Linux and Windows, and both
platforms on macOS.
For a stricter gate, pam production:certify --platform android also runs the
audit with --deny-high, regenerates typed contracts, and performs a release
build, without packaging.
Releasing from CI
Section titled “Releasing from CI”Store credentials as CI secrets and write them to files only for the duration of the job. A GitHub Actions job for Android might look like this:
jobs: android: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: distribution: temurin java-version: '17' - name: Install PAM run: | curl -fsSL https://pamphp.com/install | sh echo "$HOME/.local/bin" >> "$GITHUB_PATH" - name: Install dependencies run: pam composer install --no-dev - name: Prepare the toolchain run: pam doctor --fix - name: Restore the keystore run: echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/release.jks" env: ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} - name: Audit and package run: | pam audit --deny-high pam release --platform android env: PAM_ANDROID_KEYSTORE: ${{ runner.temp }}/release.jks PAM_ANDROID_KEY_ALIAS: release PAM_ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} PAM_ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} - uses: actions/upload-artifact@v4 with: name: android-release path: dist/Adapt the install step to the method in
Installation. The same pattern works for iOS on a macOS
runner, with your certificate imported into a temporary keychain and the two
PAM_IOS_* variables set.
Build hygiene
Section titled “Build hygiene”Release commands copy their deliverables to dist/ first, then remove
regenerable intermediates (Gradle outputs, Xcode DerivedData and archives,
temporary hosts), on success and on failure. Your source, configuration,
Composer dependencies, and credentials are never touched. Keep dist/ out of
version control and upload it as a CI artifact. See
Build hygiene.
Release checklist
Section titled “Release checklist”versionCodeincreased andversionNameupdated inpam-native.json.pam audit --deny-highreviewed; every high finding is backed by a feature.- Only the
pam-native-*plugins you use are installed. - Release dependencies installed without dev packages.
- A release-optimized build tested on a physical device: startup, the longest lists, backgrounding, and rotation.
- No content under the status bar, notch, or navigation bar on gesture and three-button navigation; see Safe areas.
- App icons set (
android.iconandios.icon); see App store submission. - Signing secrets stored only in your secret manager and CI.