From fe2bd8d391000a61eee7d4426997ebe5dfeef2d6 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 21 Apr 2025 21:36:07 +0300 Subject: [PATCH] fix(ci/cd): test-flight --- .gitea/workflows/test-flight-cd.yaml | 1 - Build-tf | 83 ++++++++-------------------- Support/ExportOptions.plist | 19 ++++--- 3 files changed, 34 insertions(+), 69 deletions(-) diff --git a/.gitea/workflows/test-flight-cd.yaml b/.gitea/workflows/test-flight-cd.yaml index 4091872b..21e7cb31 100644 --- a/.gitea/workflows/test-flight-cd.yaml +++ b/.gitea/workflows/test-flight-cd.yaml @@ -19,7 +19,6 @@ jobs: issuer-id: ${{ vars.APPSTORE_ISSUER_ID }} api-key-id: ${{ vars.APPSTORE_KEY_ID }} api-private-key: ${{ vars.APPSTORE_PRIVATE_KEY }} - keychain-password: 1 - run: | chmod +x ./Build-tf diff --git a/Build-tf b/Build-tf index 6690afb9..23082068 100644 --- a/Build-tf +++ b/Build-tf @@ -1,34 +1,8 @@ -#!/usr/bin/env bash +#!/bin/bash +BUILD_NAME="1.0.0" +BUILD_NUMBER="1" +EXPORT_OPTIONS_PLIST="Support/ExportOptions.plist" -set -xeu -set -o pipefail - -export LANG=en_US.UTF-8 -LANG=en_US.UTF-8 - -function finish() { - if [[ -d "${RESULT_BUNDLE_PATH}" ]]; then - ditto -c -k --sequesterRsrc --keepParent "${RESULT_BUNDLE_PATH}" "${RESULT_BUNDLE_PATH}.zip" - rm -rf "${RESULT_BUNDLE_PATH}" - fi -} - -trap finish EXIT - -SDK="${SDK:-iphoneos}" -WORKSPACE="${WORKSPACE:-ios/Runner.xcworkspace}" -SCHEME="${SCHEME:-Runner}" -CONFIGURATION="${CONFIGURATION:-Release}" - -BUILD_DIR="${BUILD_DIR:-build}" -ARTIFACT_PATH="${RESULT_PATH:-${BUILD_DIR}/Artifacts}" -RESULT_BUNDLE_PATH="${ARTIFACT_PATH}/${SCHEME}.xcresult" -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 dart run build_runner build --delete-conflicting-outputs @@ -37,37 +11,28 @@ cd ios rm -rf Pods Podfile.lock pod install --repo-update pod update || { echo "Pod update failed"; exit 1; } -cd .. +echo "Building iOS IPA" -rm -rf "${RESULT_BUNDLE_PATH}" "${DERIVED_DATA_PATH}" -mkdir -p "${ARTIFACT_PATH}" +flutter build ipa \ + --build-name="$BUILD_NAME" \ + --build-number="$BUILD_NUMBER" \ + --export-options-plist="$EXPORT_OPTIONS_PLIST" \ + --release \ + -v -# Archive the build -xcrun xcodebuild \ - -workspace "${WORKSPACE}" \ - -scheme "${SCHEME}" \ - -configuration "${CONFIGURATION}" \ - -sdk "${SDK}" \ - -parallelizeTargets \ - -showBuildTimingSummary \ - -derivedDataPath "${DERIVED_DATA_PATH}" \ - -archivePath "${ARCHIVE_PATH}" \ - -resultBundlePath "${RESULT_BUNDLE_PATH}" \ - -allowProvisioningUpdates \ - CURRENT_PROJECT_VERSION="${CURRENT_PROJECT_VERSION}" \ - DEVELOPMENT_TEAM=VL68C36HYS \ - archive || { echo "Xcode archive failed"; exit 1; } +BUILD_RESULT=$? +echo "Build exit code: $BUILD_RESULT" +echo "Contents of build directory:" +ls -R build/ios/ -# Export the build to .ipa -xcrun xcodebuild \ - -exportArchive \ - -exportOptionsPlist "${EXPORT_OPTIONS_FILE}" \ - -archivePath "${ARCHIVE_PATH}" \ - -exportPath "${ARTIFACT_PATH}/${SCHEME}.ipa" || { echo "Export to IPA failed"; exit 1; } - -# Zip the archive -if [[ -d "${ARCHIVE_PATH}" ]]; then - ditto -c -k --sequesterRsrc --keepParent "${ARCHIVE_PATH}" "${ARTIFACT_PATH}/${SCHEME}.xcarchive.zip" +if [ $BUILD_RESULT -eq 0 ]; then + echo "Build completed successfully!" + echo "IPA file location: ./build/ios/ipa/" else - echo "Archive directory not found, skipping zip." + echo "Build failed!" + echo "Please ensure:" + echo "1. Valid provisioning profile is configured in Xcode" + echo "2. exportOptions.plist contains correct provisioning profile information" + echo "3. Signing certificates are properly installed" + exit 1 fi diff --git a/Support/ExportOptions.plist b/Support/ExportOptions.plist index 264b71da..e4667480 100644 --- a/Support/ExportOptions.plist +++ b/Support/ExportOptions.plist @@ -8,19 +8,20 @@ method app-store + provisioningProfiles + + com.eatvioapp.app + Distribution + + signingCertificate + Apple Distribution: ITVIO, OOO (VL68C36HYS) signingStyle - automatic + automatic stripSwiftSymbols uploadSymbols teamID - VL68C36HYS - teamName - ITVIO, OOO - bundleIdentifier - com.eatvioapp.app - automaticallyManageSigning - + VL68C36HYS - + \ No newline at end of file