Last active
February 10, 2025 18:00
-
-
Save auxbh/1957f75ac348272c5406f9f5d49dc898 to your computer and use it in GitHub Desktop.
This file contains 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 | |
DATE=$(date '+%Y-%m-%d') | |
# Checks if directory already exists | |
if [ -d cardinal-gate-react-native ]; then | |
echo "Directory already exists. Pulling latest release from GitHub." | |
# cd into repo directory | |
cd cardinal-gate-react-native | |
# Pulls latest version from Github | |
git pull | |
else | |
echo "Directory does not exist. Cloning latest release from GitHub." | |
# Clones latest version from Github | |
git clone https://github.com/Radioo/cardinal-gate-react-native | |
# cd into repo directory | |
cd cardinal-gate-react-native | |
fi | |
# Gets the commit ID for the file name | |
COMMIT_ID=$(git rev-parse --short master) | |
# Initialize npm | |
npm install | |
# Expo pre-build | |
npx expo prebuild | |
# cd into ios directory | |
cd ios | |
# Unsigned build using xcode | |
NODE_ENV=dev xcodebuild -workspace CARDINALGATE.xcworkspace -scheme CARDINALGATE -configuration Release clean archive -archivePath buildArchive/CARDINALGATE.xcarchive CODE_SIGN_IDENTITY=”” CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | |
# Final message | |
if [ -d buildArchive/CARDINALGATE.xcarchive/Products/Applications ]; then | |
echo "Build suceeded!" | |
else | |
echo "Build failed." | |
exit 1 | |
fi | |
# cd into root directory | |
cd ../.. | |
# Make temporary Payload folder | |
mkdir Payload | |
# Copy .app file | |
cp -r cardinal-gate-react-native/ios/buildArchive/CARDINALGATE.xcarchive/Products/Applications/CARDINALGATE.app Payload/ | |
# Zip the .app file | |
zip -qr Payload.zip Payload | |
# Rename the .zip to .ipa | |
mv Payload.zip CARDINALGATE_${DATE}_${COMMIT_ID}.ipa | |
# Remove the Payload folder | |
rm -rf Payload | |
# Prompting if user wants to delete the repo folder or not | |
echo 'Would you like to delete the repository folder? Type "yes" to delete it or press Enter to keep it' | |
read -r user_choice | |
if [ "$user_choice" = "yes" ]; then | |
echo "Deleting the repository folder..." | |
rm -rf cardinal-gate-react-native | |
else | |
echo "Keeping the repository folder" | |
fi | |
echo "All done! IPA file can be found as CARDINALGATE_${DATE}_${COMMIT_ID}.ipa" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment