Android

ant build your.apk

apktool d -b -f your.apk -o outputDir

cp -r outputDir tempDir

your custem operate(something like change logo , icon , splashView , update your app's script code or res by version control software)

apktool b tempDir -o temp.apk

jarsigner -verbose -digestalg SHA1 -sigalg MD5withRSA -keystore your.keystore -storepass your_keystore_pass -signedjar outputSigned.apk input.apk(temp.apk) alias

zipalign -f -v 4 outputSigned.apk final.apk

zipalign -c -v 4 final.apk //验证对齐

scp to your server or whatever

iOS


xcode click archive to make your.app 
or Xcodebuild 

cp -r your.app tempDir.app

your custem operate(something like modify your icons , LaunchImage , Info.plist , i18n ......)

cp your_mobile-provision_file tempDir.app/embedded.mobileprovision

/usr/libexec/PlistBuddy -x -c "print :Entitlements " /dev/stdin <<< $(security cms -D -i tempDir.app/embedded.mobileprovision)> tempDir.app/entitlements.plist

/usr/bin/codesign -f -vv -s yourCodeSignName --entitlements tempDir.app/entitlements.plist output.app

xcrun -sdk iphoneos PackageApplication -v output.app -o final.ipa