Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. # The following is test script to execute in pre build process
  2.  
  3. #!/usr/bin/env bash
  4. #
  5. # For Xamarin Android or iOS, change the package name located in AndroidManifest.xml and Info.plist.
  6.  
  7. INFO_PLIST_FILE=$APPCENTER_SOURCE_DIRECTORY/MyWeatherApp/MyWeatherApp.iOS/Info.plist
  8.  
  9. if [ ! -n "$INFO_PLIST_FILE" ]
  10. then
  11. echo "You need define Info.plist in your iOS project"
  12. exit
  13. fi
  14.  
  15. echo "APPCENTER_SOURCE_DIRECTORY: " $APPCENTER_SOURCE_DIRECTORY
  16. echo "INFO_PLIST_FILE: " $INFO_PLIST_FILE
  17.  
  18. # Check branch and run commands if so:
  19. if [ "$APPCENTER_BRANCH" == "master" ]; then
  20.  
  21. # Convert .plist file to .json
  22. plutil -convert json $INFO_PLIST_FILE -o temp.json
  23.  
  24. jq '.' temp.json
  25.  
  26. VERSION=$(jq -r '.CFBundleShortVersionString' temp.json)
  27. BUILD=$(jq -r '.CFBundleVersion' temp.json)
  28.  
  29. echo "Current version: " $VERSION
  30. echo "Current build: " $BUILD
  31.  
  32. # Actually increment the version in this line
  33. UPDATED_VERSION=$(bc <<< "$VERSION + 0.1")
  34.  
  35. echo "Updated version: " $UPDATED_VERSION
  36.  
  37. echo "Updating Build to $APPCENTER_BUILD_ID in Info.plist"
  38. plutil -replace CFBundleVersion -string $APPCENTER_BUILD_ID $INFO_PLIST_FILE
  39.  
  40. echo "Updating Version to $UPDATED_VERSION in Info.plist"
  41. plutil -replace CFBundleShortVersionString -string $UPDATED_VERSION $INFO_PLIST_FILE
  42.  
  43. fi
  44.  
  45. if [ "$APPCENTER_BRANCH" == "development" ]; then
  46.  
  47. # Convert .plist file to .json
  48. plutil -convert json $INFO_PLIST_FILE -o temp.json
  49.  
  50. jq '.' temp.json
  51.  
  52. VERSION=$(jq -r '.CFBundleShortVersionString' temp.json)
  53. BUILD=$(jq -r '.CFBundleVersion' temp.json)
  54.  
  55. # Print the values
  56. echo "Current version: " $VERSION
  57. echo "Current build: " $BUILD
  58.  
  59. fi
  60.  
  61. echo "Info.plist file content:"
  62. cat $INFO_PLIST_FILE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement