Skip to content

Instantly share code, notes, and snippets.

@haiyon
Last active February 14, 2017 03:40
Show Gist options
  • Select an option

  • Save haiyon/ba6ffa7c1d1c2f01b44334c864fe702c to your computer and use it in GitHub Desktop.

Select an option

Save haiyon/ba6ffa7c1d1c2f01b44334c864fe702c to your computer and use it in GitHub Desktop.
Code Push Publish Shell
#!/bin/bash
today=$(date +%Y%m%d%H%M%S)
log_file="./release/logs/release_${today}.log"
Publish(){
app_name=$1 platform=$2 varsion=$3
react-native bundle --platform ${platform} --entry-file index.${platform}.js --bundle-output ./release/${platform}/main.jsbundle --assets-dest ./release/${platform} --dev false
code-push release ${app_name} ./release/${platform}/main.jsbundle ${varsion}
}
CheckCommond(){
which react-native &> /dev/null;
[ $? -ne 0 ] && { echo 'no react-native-cli installed. npm install -g react-native-cli' && exit;}
which code-push &> /dev/null;
[ $? -ne 0 ] && { echo 'no code-push-cli installed. npm install -g code-push-cli' && exit ;}
}
CheckCommond
echo '------ Please Select Platform ------'
select Platfrom in ios android;
do
read -p 'app name and version: (name version) ' name version
[ "${version}" \= '' ] && continue
case ${Platfrom} in
ios)
Publish ${name} ios ${version} && exit;
;;
android)
Publish ${name} android ${version} && exit;
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment