Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[Expo] Updates release channels and publishes to unique channel, based on version number.
# acceptable values for arg $1 are prod and beta
echo "Publishing to $1";
iOSBuildNumber="$(json -f app.json | json expo.ios.buildNumber)"
androidVersionCode="$(json -f app.json | json expo.android.versionCode)"
channelIOS="$1_ios_$iOSBuildNumber";
channelAndroid="$1_android_$androidVersionCode";
hostUriIOS="exp.host/@EXPO_USERNAME/PROJECT_NAME?release-channel=$channelIOS";
hostUriAndroid="exp.host/@EXPO_USERNAME/PROJECT_NAME?release-channel=$channelAndroid";
# Update all the config
name="$(json -f scripts/$1Config.json | json name)";
id="$(json -f scripts/$1Config.json | json id)";
slug="$(json -f scripts/$1Config.json | json slug)";
json -I -f app.json -e "this.expo.android.package = \"$id\"; this.expo.ios.bundleIdentifier = \"$id\"";
# Update all the host URI locations
plutil -replace manifestUrl -string "exp://$hostUriIOS" ./ios/PROJECT_NAME/Supporting/EXShell.plist;
echo "Updated EXSheel.plist manfiestUrl to exp://$hostUriIOS"
plutil -replace CFBundleDisplayName -string "$name" ./ios/PROJECT_NAME/Supporting/info.plist;
echo "Updated info.plist CFBundleDisplayName to $name"
# plutil -replace bundleIdentifier -string "$id" ./ios/PROJECT_NAME/Supporting/EXShell.plist;
sed -i '' "s/?release-channel=.*\"/?release-channel=$channelAndroid\"/" ./android/app/src/main/java/host/exp/exponent/MainActivity.java;
echo "Updated MainActivity.java release-channel to $channelAndroid"
json -I -f ./ios/PROJECT_NAME/Supporting/shell-app-manifest.json -e "this.hostUri = \"$hostUriIOS\"";
echo "Updated ios/../shell-app-manifest.json to $hostUriIOS"
json -I -f ./android/app/src/main/assets/shell-app-manifest.json -e "this.hostUri = \"$hostUriAndroid\"";
echo "Updated android/../shell-app-manifest.json to $hostUriAndroid"
expo p --release-channel="$channelIOS";
expo p --release-channel="$channelAndroid";
echo "published to $channelIOS and $channelAndroid";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment