diff --git a/.gitea/workflows/deploy-android.yaml b/.gitea/workflows/deploy-android.yaml deleted file mode 100644 index 6e8e947..0000000 --- a/.gitea/workflows/deploy-android.yaml +++ /dev/null @@ -1,88 +0,0 @@ -name: Deploy Flutter to Firebase (Mac) -on: - push: - branches: release - -jobs: - deploy-android: - runs-on: macos-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Vérifier l'installation Flutter - run: flutter doctor -v - - - name: Installer les dépendances Flutter - run: flutter pub get - - - name: Créer les fichiers secrets - run: | - echo "${{ secrets.ENV_FILE }}" > .env - printf '%s' '${{ secrets.FIREBASE_CREDENTIALS }}' > ./android/firebase_credentials.json - - - name: Lancer Fastlane (Force APK) - working-directory: ./android - env: - ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} - RAW_PROPERTIES: ${{ secrets.ANDROID_KEY_PROPERTIES }} - FIREBASE_ANDROID_APP_ID: ${{ secrets.FIREBASE_ANDROID_APP_ID }} - run: | - # 1. Config Ruby - export PATH="/opt/homebrew/opt/ruby/bin:$PATH" - export GEM_HOME=$PWD/vendor/bundle - export GEM_PATH=$PWD/vendor/bundle - export PATH=$GEM_HOME/bin:$PATH - - # 2. Keystore & Properties - echo "$ANDROID_KEYSTORE_BASE64" | base64 -D > keystore.jks - KEYSTORE_PATH=$(pwd)/keystore.jks - - echo "$RAW_PROPERTIES" > temp_props.txt - STORE_PASS=$(grep "storePassword" temp_props.txt | cut -d'=' -f2 | tr -d '\r') - KEY_PASS=$(grep "keyPassword" temp_props.txt | cut -d'=' -f2 | tr -d '\r') - KEY_ALIAS=$(grep "keyAlias" temp_props.txt | cut -d'=' -f2 | tr -d '\r') - - echo "storePassword=$STORE_PASS" > key.properties - echo "keyPassword=$KEY_PASS" >> key.properties - echo "keyAlias=$KEY_ALIAS" >> key.properties - echo "storeFile=$KEYSTORE_PATH" >> key.properties - - # 3. Installation Dépendances - rm -rf vendor Gemfile.lock .bundle - echo "source 'https://rubygems.org'" > Gemfile - echo "gem 'fastlane', '>= 2.210.0'" >> Gemfile - echo "gem 'fastlane-plugin-firebase_app_distribution'" >> Gemfile - # Patchs Ruby 3.4 - echo "gem 'abbrev'" >> Gemfile - echo "gem 'ostruct'" >> Gemfile - echo "gem 'mutex_m'" >> Gemfile - echo "gem 'base64'" >> Gemfile - echo "gem 'csv'" >> Gemfile - echo "gem 'bigdecimal'" >> Gemfile - echo "gem 'drb'" >> Gemfile - echo "gem 'nkf'" >> Gemfile - - echo "⬇️ Installation..." - gem install bundler -v 2.7.2 --force --no-document - bundle _2.7.2_ update --jobs 4 - - # 4. CONSTRUCTION ET ENVOI MANUEL EN APK 🗝️ - # On remonte à la racine pour lancer Flutter - cd .. - - echo "🚧 Construction de l'APK (Format compatible sans Play Store)..." - # C'est cette commande qui change tout : APK au lieu de AppBundle - flutter build apk --release - - # On redescend dans le dossier android pour lancer fastlane - cd android - - echo "🚀 Envoi de l'APK vers Firebase..." - # On pointe vers le fichier APK généré - bundle _2.7.2_ exec fastlane run firebase_app_distribution \ - app:"$FIREBASE_ANDROID_APP_ID" \ - android_artifact_path:"../build/app/outputs/flutter-apk/app-release.apk" \ - service_credentials_file:"firebase_credentials.json" \ - release_notes:"Build APK via Act - Test" \ No newline at end of file diff --git a/.gitea/workflows/deploy-ios.yaml b/.gitea/workflows/deploy-ios.yaml deleted file mode 100644 index 3660081..0000000 --- a/.gitea/workflows/deploy-ios.yaml +++ /dev/null @@ -1,121 +0,0 @@ -name: Deploy Flutter to Firebase iOS -on: - push: - branches: release - -jobs: - deploy-ios: - runs-on: macos-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Configurer Xcode & Flutter - run: | - # Xcode 26.2 est optimisé pour les builds parallèles - xcodebuild -version - flutter pub get - - - name: Installer Cocoapods - run: | - cd ios - # Force la mise à jour pour Firebase 12.6.0 - pod install --repo-update || pod update - cd .. - - - name: Créer les fichiers de configuration (Secrets) - run: | - # Création du .env à la racine pour éviter l'erreur d'asset - echo "${{ secrets.ENV_FILE }}" > .env - - # Création des credentials Firebase - printf '%s' '${{ secrets.FIREBASE_CREDENTIALS }}' > ./ios/firebase_credentials.json - - - name: Préparer le Code Signing (Mode Safe) - env: - P12_BASE: ${{ secrets.IOS_P12_BASE64 }} - P12_PASS: ${{ secrets.IOS_P12_PASSWORD }} - PROV_BASE: ${{ secrets.IOS_PROVISION_BASE64 }} - run: | - # 1. Nettoyage et création d'un trousseau temporaire isolé - security delete-keychain build.keychain || true - security create-keychain -p "" build.keychain - security unlock-keychain -p "" build.keychain - - # 2. Ajout à la liste de recherche (Indispensable pour Xcode 26.2) - # Permet à Xcode de trouver le certificat sans impacter tes autres apps - security list-keychains -d user -s build.keychain $(security list-keychains -d user | xargs) - - # 3. Importation du Certificat Apple Distribution - echo "$P12_BASE" | base64 -D -o cert.p12 - security import cert.p12 -k build.keychain -P "$P12_PASS" -T /usr/bin/codesign -T /usr/bin/productsign - - # 4. Autorisation de signature sans popup - security set-key-partition-list -S apple-tool:,apple: -s -k "" build.keychain - - # 5. Installation du Profil de Provisionnement mis à jour (avec Push Notifications) - mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles - echo "$PROV_BASE" | base64 -D -o ~/Library/MobileDevice/Provisioning\ Profiles/distribution.mobileprovision - - - name: Build IPA (Release) - run: | - # Build de l'archive via Xcode 26.2 - # L'asset .env est maintenant correctement détecté à la racine - flutter build ipa --release --export-method ad-hoc - - - name: Envoi vers Firebase App Distribution - env: - FIREBASE_IOS_APP_ID: ${{ secrets.FIREBASE_IOS_APP_ID }} - run: | - # 1. Configuration du chemin Ruby Homebrew - export PATH="/opt/homebrew/opt/ruby/bin:/opt/homebrew/bin:$PATH" - gem install bundler -v 2.7.2 --no-document - - # 2. Entrer dans le dossier ios avant toute opération - cd ios - - # 3. Création du Gemfile "blindé" pour Ruby 3.4 - # On écrase tout ancien fichier pour être sûr de repartir sur du propre - echo "source 'https://rubygems.org'" > Gemfile - echo "gem 'fastlane', '>= 2.214.0'" >> Gemfile - echo "gem 'fastlane-plugin-firebase_app_distribution'" >> Gemfile - - # Correctifs pour les gems retirées du cœur de Ruby 3.4 - echo "gem 'ostruct'" >> Gemfile - echo "gem 'nkf'" >> Gemfile - echo "gem 'abbrev'" >> Gemfile - echo "gem 'base64'" >> Gemfile - echo "gem 'csv'" >> Gemfile - echo "gem 'mutex_m'" >> Gemfile - echo "gem 'bigdecimal'" >> Gemfile - - # 4. Installation des dépendances dans le dossier local - bundle _2.7.2_ config set path 'vendor/bundle' - bundle _2.7.2_ install - - # 5. Recherche dynamique de l'IPA - # On cherche depuis la racine du projet (un dossier au-dessus) - echo "🔍 Localisation de l'IPA..." - IPA_PATH=$(find .. -name "*.ipa" -not -path "*/Pods/*" | head -n 1) - - if [ -z "$IPA_PATH" ]; then - echo "❌ ERREUR : Aucun fichier .ipa trouvé. Vérifie l'étape de build." - exit 1 - fi - echo "📦 IPA détectée : $IPA_PATH" - - # 6. Envoi final vers Firebase - echo "🚀 Téléchargement vers Firebase App Distribution..." - bundle _2.7.2_ exec fastlane run firebase_app_distribution \ - app:"$FIREBASE_IOS_APP_ID" \ - ipa_path:"$IPA_PATH" \ - service_credentials_file:"firebase_credentials.json" \ - release_notes: "Build stable TravelMate - Xcode 26.2" - - - name: Nettoyage (Post-build) - if: always() - run: | - # Restauration de l'état du Trousseau pour ton Mac perso - security list-keychains -d user -s login.keychain - security delete-keychain build.keychain || true \ No newline at end of file diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml new file mode 100644 index 0000000..4e23462 --- /dev/null +++ b/.gitea/workflows/deploy.yaml @@ -0,0 +1,113 @@ +name: Deploy TravelMate (Android & iOS) +on: + push: + branches: + - release # Assure-toi de pousser sur cette branche exacte + +jobs: + # --- JOB 1 : ANDROID (APK) --- + deploy-android: + runs-on: macos-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Dépendances Flutter & Secrets + run: | + flutter pub get + echo "${{ secrets.ENV_FILE }}" > .env + printf '%s' '${{ secrets.FIREBASE_CREDENTIALS }}' > ./android/firebase_credentials.json + + - name: Build & Deploy Android + working-directory: ./android + env: + ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} + RAW_PROPERTIES: ${{ secrets.ANDROID_KEY_PROPERTIES }} + FIREBASE_ANDROID_APP_ID: ${{ secrets.FIREBASE_ANDROID_APP_ID }} + run: | + # 1. Keystore & Properties + echo "$ANDROID_KEYSTORE_BASE64" | base64 -D > keystore.jks + echo "$RAW_PROPERTIES" > temp_props.txt + echo "storePassword=$(grep 'storePassword' temp_props.txt | cut -d'=' -f2 | tr -d '\r')" > key.properties + echo "keyPassword=$(grep 'keyPassword' temp_props.txt | cut -d'=' -f2 | tr -d '\r')" >> key.properties + echo "keyAlias=$(grep 'keyAlias' temp_props.txt | cut -d'=' -f2 | tr -d '\r')" >> key.properties + echo "storeFile=$(pwd)/keystore.jks" >> key.properties + + # 2. Gemfile Ruby 3.4 Patches + echo "source 'https://rubygems.org'" > Gemfile + echo "gem 'fastlane', '>= 2.210.0'" >> Gemfile + echo "gem 'fastlane-plugin-firebase_app_distribution'" >> Gemfile + for g in abbrev ostruct mutex_m base64 csv bigdecimal drb nkf; do echo "gem '$g'" >> Gemfile; done + + gem install bundler -v 2.7.2 --no-document + bundle _2.7.2_ update + + # 3. Build APK + cd .. && flutter build apk --release && cd android + + # 4. Envoi Firebase + bundle _2.7.2_ exec fastlane run firebase_app_distribution \ + app:"$FIREBASE_ANDROID_APP_ID" \ + android_artifact_path:"../build/app/outputs/flutter-apk/app-release.apk" \ + service_credentials_file:"firebase_credentials.json" \ + release_notes:"Android APK stable - Xcode 26.2" + + # --- JOB 2 : IOS (IPA) --- + deploy-ios: + runs-on: macos-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Dépendances iOS & Secrets + run: | + flutter pub get + echo "${{ secrets.ENV_FILE }}" > .env + printf '%s' '${{ secrets.FIREBASE_CREDENTIALS }}' > ./ios/firebase_credentials.json + cd ios && (pod install --repo-update || pod update) + + - name: Préparer le Code Signing (Safe Mode Mac Perso) + env: + P12_BASE: ${{ secrets.IOS_P12_BASE64 }} + P12_PASS: ${{ secrets.IOS_P12_PASSWORD }} + PROV_BASE: ${{ secrets.IOS_PROVISION_BASE64 }} + run: | + security delete-keychain build.keychain || true + security create-keychain -p "" build.keychain + security unlock-keychain -p "" build.keychain + # Crucial pour Xcode 26.2 : ajouter à la liste de recherche + security list-keychains -d user -s build.keychain $(security list-keychains -d user | xargs) + echo "$P12_BASE" | base64 -D -o cert.p12 + security import cert.p12 -k build.keychain -P "$P12_PASS" -T /usr/bin/codesign + security set-key-partition-list -S apple-tool:,apple: -s -k "" build.keychain + mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles + echo "$PROV_BASE" | base64 -D -o ~/Library/MobileDevice/Provisioning\ Profiles/distribution.mobileprovision + + - name: Build IPA (Standard Xcode 26.2) + run: flutter build ipa --release --export-method ad-hoc + + - name: Envoi Firebase iOS + env: + FIREBASE_IOS_APP_ID: ${{ secrets.FIREBASE_IOS_APP_ID }} + run: | + cd ios + echo "source 'https://rubygems.org'" > Gemfile + echo "gem 'fastlane', '>= 2.210.0'" >> Gemfile + echo "gem 'fastlane-plugin-firebase_app_distribution'" >> Gemfile + for g in abbrev ostruct mutex_m base64 csv bigdecimal drb nkf; do echo "gem '$g'" >> Gemfile; done + + gem install bundler -v 2.7.2 --no-document + bundle _2.7.2_ update + + IPA_PATH=$(find .. -name "*.ipa" -not -path "*/Pods/*" | head -n 1) + bundle _2.7.2_ exec fastlane run firebase_app_distribution \ + app:"$FIREBASE_IOS_APP_ID" \ + ipa_path:"$IPA_PATH" \ + service_credentials_file:"firebase_credentials.json" \ + release_notes:"iOS IPA stable - Xcode 26.2" + + - name: Nettoyage Trousseau + if: always() + run: | + security list-keychains -d user -s login.keychain + security delete-keychain build.keychain || true \ No newline at end of file