Last active
May 3, 2020 13:57
-
-
Save kambala-decapitator/856b32899395eb942577952eda56891a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
showUsage() { | |
echo "usage: $(basename "$0") --app_identifier APP_ID --app_name APP_NAME [--group_name GROUP_NAME] [--username USERNAME] [--team_id TEAM_ID] [--team_name TEAM_NAME]" | |
} | |
if [[ $# -eq 0 ]]; then | |
showUsage | |
exit 1 | |
fi | |
# https://stackoverflow.com/a/14203146/1971301 | |
while [[ $# -gt 0 ]]; do | |
key="$1" | |
case $key in | |
--app_identifier) | |
appID="$2" | |
shift | |
shift | |
;; | |
--app_name) | |
appName="$2" | |
shift | |
shift | |
;; | |
--group_name) | |
groupName="$2" | |
shift | |
shift | |
;; | |
--username) | |
username="$2" | |
shift | |
shift | |
;; | |
--team_id) | |
teamID="$2" | |
shift | |
shift | |
;; | |
--team_name) | |
teamName="$2" | |
shift | |
shift | |
;; | |
-h|--help) | |
showUsage | |
exit 0 | |
;; | |
*) | |
echo "unknown option: $key" | |
shift | |
;; | |
esac | |
done | |
if [[ -z $appID ]]; then | |
echo "app_identifier is required" | |
showUsage | |
exit 1 | |
fi | |
if [[ -z $appName ]]; then | |
echo "app_name is required" | |
showUsage | |
exit 1 | |
fi | |
fastlane produce create \ | |
--app_identifier "$appID" \ | |
--app_name "$appName" \ | |
--skip_itc \ | |
${username:+-u "$username"} \ | |
${teamID:+--team_id "$teamID"} \ | |
${teamName:+--team_name "$teamName"} | |
if [[ $? != 0 ]]; then | |
exit 1 | |
fi | |
if [[ -z $groupName ]]; then | |
exit 0 | |
fi | |
if [[ ${appID: -1} == '*' ]]; then | |
echo "App Groups can't be enabled on a wildcard app ID" | |
exit 0 | |
fi | |
groupID="group.$appID" | |
fastlane produce enable_services \ | |
--app_identifier "$appID" \ | |
--app-group \ | |
${username:+-u "$username"} \ | |
${teamID:+--team_id "$teamID"} \ | |
${teamName:+--team_name "$teamName"} | |
fastlane produce group \ | |
--group_identifier "$groupID" \ | |
--group_name "$groupName" \ | |
${username:+-u "$username"} \ | |
${teamID:+--team_id "$teamID"} \ | |
${teamName:+--team_name "$teamName"} | |
fastlane produce associate_group \ | |
--app_identifier "$appID" \ | |
"$groupID" \ | |
${username:+-u "$username"} \ | |
${teamID:+--team_id "$teamID"} \ | |
${teamName:+--team_name "$teamName"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment