Files
TravelMate/.gitea/workflows/deploy.yaml
Van Leemput Dayron acfb2259cc
Some checks failed
Deploy TravelMate Final Fix / deploy-all (push) Failing after 1m12s
test 31
2026-01-11 00:12:56 +01:00

104 lines
4.5 KiB
YAML

name: Deploy TravelMate Final Fix
on:
push:
branches:
- release
jobs:
deploy-all:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: 1. Setup Environnement & Assets
run: |
flutter pub get
# On crée le .env à la racine ET dans ios/ pour être sûr que Flutter le voit
echo "${{ secrets.ENV_FILE }}" > .env
cp .env ios/.env
# Vérification immédiate
if [ ! -s .env ]; then echo "ERREUR: Le secret ENV_FILE est vide !"; exit 1; fi
printf '%s' '${{ secrets.FIREBASE_CREDENTIALS }}' > ./ios/firebase_credentials.json
printf '%s' '${{ secrets.FIREBASE_CREDENTIALS }}' > ./android/firebase_credentials.json
- name: 2. Build Android (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: |
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
cd .. && flutter build apk --release && cd android
# Ruby Patches pour Ruby 3.4
echo "source 'https://rubygems.org'\ngem 'fastlane'\ngem 'fastlane-plugin-firebase_app_distribution'" > Gemfile
for g in abbrev ostruct mutex_m base64 csv bigdecimal drb nkf reline logger; do echo "gem '$g'" >> Gemfile; done
bundle install --path vendor/bundle
bundle 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"
- name: 3. Préparer iOS (Signing)
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
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
cd ios && pod install --repo-update
- name: 4. Build IPA (iOS)
run: |
flutter clean
flutter pub get
# On force le build en Ad-Hoc
flutter build ipa --release --export-method ad-hoc
- name: 5. Debug & Envoi Firebase iOS
env:
FIREBASE_IOS_APP_ID: ${{ secrets.FIREBASE_IOS_APP_ID }}
run: |
cd ios
echo "source 'https://rubygems.org'\ngem 'fastlane'\ngem 'fastlane-plugin-firebase_app_distribution'" > Gemfile
for g in abbrev ostruct mutex_m base64 csv bigdecimal drb nkf reline logger; do echo "gem '$g'" >> Gemfile; done
bundle install --path vendor/bundle
# ON CHERCHE L'IPA PARTOUT ET ON LISTE TOUT SI PAS TROUVÉ
echo "🔍 Recherche de l'IPA..."
IPA_PATH=$(find .. -name "*.ipa" | head -n 1)
if [ -z "$IPA_PATH" ]; then
echo "❌ IPA NON GÉNÉRÉE. Listing du dossier build pour comprendre :"
ls -R ../build
exit 1
fi
echo "📦 IPA trouvée : $IPA_PATH"
bundle exec fastlane run firebase_app_distribution \
app:"$FIREBASE_IOS_APP_ID" \
ipa_path:"$IPA_PATH" \
service_credentials_file:"firebase_credentials.json"
- name: 6. Nettoyage
if: always()
run: security delete-keychain build.keychain || true