Skip to content

Instantly share code, notes, and snippets.

@xuan9
Last active May 6, 2021 06:50
Show Gist options
  • Save xuan9/b2993405c30fe80bf9869d5ed82403de to your computer and use it in GitHub Desktop.
Save xuan9/b2993405c30fe80bf9869d5ed82403de to your computer and use it in GitHub Desktop.
react native packaging scripts
export shortVersion=$( /usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" ios/myapp/Info.plist );
export bundleVersion=$( /usr/libexec/PlistBuddy -c "Print CFBundleVersion" ios/myapp/Info.plist );
export distName=MyApp-$shortVersion-$bundleVersion
<?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</string>
<key>provisioningProfiles</key>
<dict>
<key>com.my.app</key>
<string>prod-provisioningProfiles-name</string>
</dict>
<key>signingCertificate</key>
<string>iPhone Distribution</string>
<key>signingStyle</key>
<string>manual</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>....</string>
<key>uploadBitcode</key>
<false/>
<key>uploadSymbols</key>
<true/>
</dict>
</plist>
#!/bin/bash
#set -ex
# This scripts allows you to upload a binary to the iTunes Connect Store
# Requires application loader to be installed
# See https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SubmittingTheApp.html
# Itunes Connect username & password
# I store my username and password in a seprate file outside the repo. With the format `username password`
USER=$(awk 'BEGIN {FS=" "}; {print $1}' ./tools/itunes)
PASS=$(awk 'BEGIN {FS=" "}; {print $2}' ./tools/itunes)
ALTOOL="/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Versions/A/Support/altool"
"$ALTOOL" --upload -f $1 -u ${USER} -p ${PASS}
{
"name": "myapp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"iphone": "react-native run-ios --configuration Release --device",
"clean-bundle:ios": "rm -f ./ios/main.jsbundle*",
"bundle:ios": "npm run clean-bundle:ios; node node_modules/react-native/local-cli/cli.js bundle --platform ios --dev false --entry-file index.ios.js --bundle-output ./ios/main.jsbundle --assets-dest ./ios",
"clean:ios": "cd ios; xcodebuild clean -project myapp.xcodeproj -configuration Release -alltargets",
"build:ios": ". ./tools/getiOSDistName.sh; npm clean:ios; cd ios; xcodebuild archive -scheme myapp -project myapp.xcodeproj -configuration Relase -archivePath ../releases/$distName; xcodebuild -exportArchive -archivePath releases/$distName.xcarchive -exportPath releases/$distName.ipa -exportOptionsPlist tools/iosExportOptions.plist",
"upload:ios": ". ./tools/getiOSDistName.sh; ./tools/itunes_upload.sh releases/$distName.ipa/myapp.ipa",
"bundle:android": "npm run clean-bundle:android; node node_modules/react-native/local-cli/cli.js bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/",
"assemble:android": "cd android; ./gradlew assembleRelease --stacktrace; ls -la `pwd`/app/build/outputs/apk/release/*.apk;mv app/build/outputs/apk/release/*.apk ../releases/",
"clean:android": "cd android; ./gradlew clean;",
"release:android": "npm run bundle:android; npm run clean:android; npm run assemble:android;"
},
"dependencies": {
"mobx": "^3.6.2",
"mobx-logger": "^0.6.0",
"mobx-persist": "^0.3.4",
"mobx-react": "^4.4.3",
"native-base": "^2.3.10",
"react": "^16.2.0",
"react-native": "^0.52.3",
"react-native-device-info": "^0.13.0",
"react-native-keychain": "^2.0.0",
"react-native-linear-gradient": "^2.4.0",
"react-native-simple-toast": "^0.0.7",
"react-native-splash-screen": "^3.0.6",
"react-native-vector-icons": "^4.5.0",
"react-navigation": "^1.1.2"
},
"devDependencies": {
"babel-jest": "^19.0.0",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-react-native": "^2.1.0",
"jest": "^19.0.2",
"react-test-renderer": "^16.2.0"
},
"jest": {
"preset": "react-native"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment