diff --git a/Build-tf b/Build-tf
index fd6acc1d..13c0fc98 100755
--- a/Build-tf
+++ b/Build-tf
@@ -13,32 +13,32 @@ function finish() {
trap finish EXIT
-SDK="iphoneos"
-WORKSPACE="ios/Runner.xcworkspace"
-SCHEME="Runner"
-CONFIGURATION="Release"
+SDK="${SDK:-iphoneos}"
+WORKSPACE="${WORKSPACE:-ios/Runner.xcworkspace}"
+SCHEME="${SCHEME:-Runner}"
+CONFIGURATION="${CONFIGURATION:-Release}"
-BUILD_DIR="build"
-ARTIFACT_PATH="${BUILD_DIR}/Artifacts"
+BUILD_DIR="${BUILD_DIR:-build}"
+ARTIFACT_PATH="${RESULT_PATH:-${BUILD_DIR}/Artifacts}"
RESULT_BUNDLE_PATH="${ARTIFACT_PATH}/${SCHEME}.xcresult"
-ARCHIVE_PATH="${BUILD_DIR}/Archives/${SCHEME}.xcarchive"
-DERIVED_DATA_PATH="${BUILD_DIR}/DerivedData"
-CURRENT_PROJECT_VERSION="1.0.0"
+ARCHIVE_PATH="${ARCHIVE_PATH:-${BUILD_DIR}/Archives/${SCHEME}.xcarchive}"
+DERIVED_DATA_PATH="${DERIVED_DATA_PATH:-${BUILD_DIR}/DerivedData}"
+CURRENT_PROJECT_VERSION="${BUILD_NUMBER:-0}"
EXPORT_OPTIONS_FILE="Support/ExportOptions.plist"
+# Clean and prepare the build
flutter clean
flutter pub get
cd ios
rm -rf Pods Podfile.lock
-pod deintegrate
pod install --repo-update
-pod update
cd ..
rm -rf "${RESULT_BUNDLE_PATH}"
rm -rf "${DERIVED_DATA_PATH}"
+# Archive the build
xcrun xcodebuild \
-workspace "${WORKSPACE}" \
-scheme "${SCHEME}" \
@@ -51,13 +51,15 @@ xcrun xcodebuild \
-archivePath "${ARCHIVE_PATH}" \
-resultBundlePath "${RESULT_BUNDLE_PATH}" \
-allowProvisioningUpdates \
- -authenticationKeyPath ~/Library/MobileDevice/Provisioning\ Profiles \
+ CURRENT_PROJECT_VERSION="${CURRENT_PROJECT_VERSION}" \
archive
+# Export the build to .ipa
xcrun xcodebuild \
-exportArchive \
-exportOptionsPlist "${EXPORT_OPTIONS_FILE}" \
-archivePath "${ARCHIVE_PATH}" \
-exportPath "${ARTIFACT_PATH}/${SCHEME}.ipa"
+# Zip the archive
ditto -c -k --sequesterRsrc --keepParent "${ARCHIVE_PATH}" "${ARTIFACT_PATH}/${SCHEME}.xcarchive.zip"
diff --git a/Support/ExportOptions.plist b/Support/ExportOptions.plist
index f863042b..11ca0543 100644
--- a/Support/ExportOptions.plist
+++ b/Support/ExportOptions.plist
@@ -11,7 +11,7 @@
provisioningProfiles
com.eatvioapp.app
- EatvioApp
+ Eatvio distribution profile
signingCertificate
Apple Distribution