feat: synchronisation mode deconnecte fin chat et stats
This commit is contained in:
305
app/docs/CODEMAGIC-IOS.md
Normal file
305
app/docs/CODEMAGIC-IOS.md
Normal file
@@ -0,0 +1,305 @@
|
||||
# Guide : Déploiement Flutter iOS via Gitea → GitHub → Codemagic → TestFlight
|
||||
|
||||
## Prérequis obligatoires
|
||||
|
||||
- [ ] Compte Apple Developer actif (99$/an)
|
||||
- [ ] App déjà créée sur App Store Connect
|
||||
- [ ] Projet Flutter fonctionnel dans Gitea
|
||||
- [ ] Compte GitHub
|
||||
- [ ] Certificats iOS et profils de provisioning
|
||||
|
||||
## Étape 1 : Configuration GitHub
|
||||
|
||||
### 1.1 Créer le dépôt GitHub
|
||||
```bash
|
||||
# Sur GitHub, créer un nouveau repository (privé recommandé)
|
||||
# Nom : même nom que votre projet Gitea
|
||||
```
|
||||
|
||||
### 1.2 Configurer les remotes Git localement
|
||||
```bash
|
||||
# Dans votre projet Flutter local
|
||||
cd /home/pierre/dev/votre-projet-flutter
|
||||
|
||||
# Ajouter GitHub comme remote supplémentaire
|
||||
git remote add github https://github.com/votre-username/votre-projet.git
|
||||
|
||||
# Vérifier les remotes
|
||||
git remote -v
|
||||
# origin https://votre-gitea.com/user/projet.git (fetch)
|
||||
# origin https://votre-gitea.com/user/projet.git (push)
|
||||
# github https://github.com/user/projet.git (fetch)
|
||||
# github https://github.com/user/projet.git (push)
|
||||
```
|
||||
|
||||
### 1.3 Push initial vers GitHub
|
||||
```bash
|
||||
# Push toutes les branches vers GitHub
|
||||
git push github --all
|
||||
git push github --tags
|
||||
```
|
||||
|
||||
## Étape 2 : Automatisation Gitea → GitHub
|
||||
|
||||
### 2.1 Script de synchronisation
|
||||
Créer un script `sync-github.sh` dans votre projet :
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# sync-github.sh
|
||||
|
||||
echo "🔄 Synchronisation vers GitHub..."
|
||||
|
||||
# Push vers Gitea (origine)
|
||||
git push origin
|
||||
|
||||
# Push vers GitHub (miroir)
|
||||
git push github
|
||||
|
||||
echo "✅ Synchronisation terminée"
|
||||
```
|
||||
|
||||
```bash
|
||||
# Rendre le script exécutable
|
||||
chmod +x sync-github.sh
|
||||
|
||||
# Utilisation
|
||||
./sync-github.sh
|
||||
```
|
||||
|
||||
### 2.2 Hook Git automatique (optionnel)
|
||||
```bash
|
||||
# Dans .git/hooks/post-commit
|
||||
#!/bin/bash
|
||||
git push github
|
||||
```
|
||||
|
||||
## Étape 3 : Configuration Apple Developer
|
||||
|
||||
### 3.1 Récupérer les certificats
|
||||
1. **Apple Developer** → Certificates
|
||||
2. Télécharger le **Distribution Certificate**
|
||||
3. Télécharger le **Provisioning Profile** (App Store)
|
||||
|
||||
### 3.2 Convertir en format P12
|
||||
```bash
|
||||
# Si vous avez le certificat .cer
|
||||
# L'ouvrir dans Keychain Access (macOS) ou utiliser OpenSSL
|
||||
# Exporter au format .p12 avec mot de passe
|
||||
```
|
||||
|
||||
### 3.3 Informations nécessaires
|
||||
Noter :
|
||||
- **Team ID** (dans Apple Developer Account)
|
||||
- **Bundle ID** (com.votredomaine.votreapp)
|
||||
- **Mot de passe du certificat P12**
|
||||
|
||||
## Étape 4 : Configuration Codemagic
|
||||
|
||||
### 4.1 Inscription et connexion
|
||||
1. Aller sur [codemagic.io](https://codemagic.io)
|
||||
2. S'inscrire avec GitHub
|
||||
3. Autoriser l'accès à vos dépôts
|
||||
|
||||
### 4.2 Ajouter le projet
|
||||
1. **Add application from repository**
|
||||
2. Sélectionner votre dépôt GitHub
|
||||
3. **Flutter App** comme type de projet
|
||||
|
||||
### 4.3 Configuration de base
|
||||
```yaml
|
||||
# codemagic.yaml à créer dans la racine du projet
|
||||
workflows:
|
||||
ios-workflow:
|
||||
name: iOS Workflow
|
||||
instance_type: mac_mini_m1
|
||||
max_build_duration: 120
|
||||
environment:
|
||||
flutter: stable
|
||||
groups:
|
||||
- app_store_credentials
|
||||
vars:
|
||||
APP_STORE_APPLE_ID: votre-apple-id@example.com
|
||||
BUNDLE_ID: com.votredomaine.votreapp
|
||||
scripts:
|
||||
- name: Set up code signing settings on Xcode project
|
||||
script: |
|
||||
xcode-project use-profiles
|
||||
- name: Get Flutter packages
|
||||
script: |
|
||||
flutter packages pub get
|
||||
- name: Flutter analyze
|
||||
script: |
|
||||
flutter analyze
|
||||
- name: Flutter unit tests
|
||||
script: |
|
||||
flutter test
|
||||
- name: Install pods
|
||||
script: |
|
||||
find . -name "Podfile" -execdir pod install \;
|
||||
- name: Flutter build ipa
|
||||
script: |
|
||||
flutter build ipa --release \
|
||||
--build-name=1.0.$BUILD_NUMBER \
|
||||
--export-options-plist=/Users/builder/export_options.plist
|
||||
artifacts:
|
||||
- build/ios/ipa/*.ipa
|
||||
- /tmp/xcodebuild_logs/*.log
|
||||
- flutter_drive.log
|
||||
publishing:
|
||||
app_store_connect:
|
||||
auth: integration
|
||||
submit_to_testflight: true
|
||||
beta_groups:
|
||||
- App Store Connect Users
|
||||
```
|
||||
|
||||
### 4.4 Upload des certificats
|
||||
1. **App settings** → **Environment variables**
|
||||
2. Créer un groupe **app_store_credentials**
|
||||
3. Upload :
|
||||
- **APP_STORE_CONNECT_ISSUER_ID**
|
||||
- **APP_STORE_CONNECT_KEY_IDENTIFIER**
|
||||
- **APP_STORE_CONNECT_PRIVATE_KEY**
|
||||
- **CERTIFICATE_PRIVATE_KEY** (contenu du .p12 en base64)
|
||||
- **CERTIFICATE_PASSWORD**
|
||||
|
||||
### 4.5 Configuration App Store Connect API
|
||||
1. **App Store Connect** → Users and Access → Integrations
|
||||
2. Générer une **App Store Connect API Key**
|
||||
3. Télécharger le fichier .p8
|
||||
4. Noter l'**Issuer ID** et **Key ID**
|
||||
|
||||
## Étape 5 : Configuration iOS spécifique
|
||||
|
||||
### 5.1 Vérifier ios/Runner.xcodeproj
|
||||
```xml
|
||||
<!-- ios/Runner/Info.plist -->
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.votredomaine.votreapp</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(FLUTTER_BUILD_NAME)</string>
|
||||
```
|
||||
|
||||
### 5.2 Signing Configuration
|
||||
```bash
|
||||
# ios/Runner.xcodeproj/project.pbxproj
|
||||
# Vérifier que le PRODUCT_BUNDLE_IDENTIFIER correspond
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.votredomaine.votreapp;
|
||||
```
|
||||
|
||||
## Étape 6 : Premier build TestFlight
|
||||
|
||||
### 6.1 Préparer le build
|
||||
```bash
|
||||
# Dans votre projet Flutter
|
||||
# Incrémenter la version dans pubspec.yaml
|
||||
version: 1.0.1+2
|
||||
|
||||
# Commit et push
|
||||
git add .
|
||||
git commit -m "feat: préparation build TestFlight v1.0.1"
|
||||
./sync-github.sh
|
||||
```
|
||||
|
||||
### 6.2 Lancer le build sur Codemagic
|
||||
1. **Codemagic Dashboard** → votre projet
|
||||
2. **Start new build**
|
||||
3. Sélectionner la branche `main`
|
||||
4. **iOS Workflow**
|
||||
5. **Start build**
|
||||
|
||||
### 6.3 Suivre le build
|
||||
- Durée estimée : 15-25 minutes
|
||||
- Vérifier les logs en cas d'erreur
|
||||
- L'IPA sera automatiquement envoyé à TestFlight
|
||||
|
||||
## Étape 7 : Validation TestFlight
|
||||
|
||||
### 7.1 Dans App Store Connect
|
||||
1. **TestFlight** → votre app
|
||||
2. Vérifier le nouveau build
|
||||
3. Ajouter des **Release Notes**
|
||||
4. **Submit for Review** (si nécessaire)
|
||||
|
||||
### 7.2 Inviter des testeurs
|
||||
1. **TestFlight** → **Internal Testing**
|
||||
2. Ajouter des testeurs internes
|
||||
3. Ou créer des groupes de **External Testing**
|
||||
|
||||
## Script complet d'automatisation
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# deploy-ios.sh
|
||||
|
||||
echo "🚀 Déploiement iOS automatisé"
|
||||
|
||||
# Vérifications préalables
|
||||
if [ -z "$1" ]; then
|
||||
echo "❌ Version manquante. Usage: ./deploy-ios.sh 1.0.1"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$1
|
||||
BUILD_NUMBER=$(git rev-list --count HEAD)
|
||||
|
||||
echo "📝 Version: $VERSION+$BUILD_NUMBER"
|
||||
|
||||
# Mise à jour de pubspec.yaml
|
||||
sed -i "s/version: .*/version: $VERSION+$BUILD_NUMBER/" pubspec.yaml
|
||||
|
||||
# Tests locaux
|
||||
echo "🧪 Tests Flutter..."
|
||||
flutter test
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "❌ Tests échoués"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Commit et push
|
||||
git add .
|
||||
git commit -m "release: v$VERSION build $BUILD_NUMBER"
|
||||
./sync-github.sh
|
||||
|
||||
echo "✅ Code pushé vers GitHub"
|
||||
echo "🔗 Allez sur Codemagic pour lancer le build iOS"
|
||||
echo "📱 TestFlight sera mis à jour automatiquement"
|
||||
```
|
||||
|
||||
## Utilisation quotidienne
|
||||
|
||||
```bash
|
||||
# Développement normal
|
||||
git add .
|
||||
git commit -m "feat: nouvelle fonctionnalité"
|
||||
./sync-github.sh
|
||||
|
||||
# Déploiement TestFlight
|
||||
./deploy-ios.sh 1.0.2
|
||||
```
|
||||
|
||||
## Dépannage courant
|
||||
|
||||
### Erreur de certificat
|
||||
- Vérifier que le Bundle ID correspond
|
||||
- Régénérer le Provisioning Profile
|
||||
- Vérifier la date d'expiration
|
||||
|
||||
### Build qui échoue
|
||||
- Vérifier les logs Codemagic
|
||||
- Tester `flutter build ios` localement
|
||||
- Vérifier les variables d'environnement
|
||||
|
||||
### TestFlight ne reçoit pas le build
|
||||
- Vérifier la configuration App Store Connect API
|
||||
- Contrôler les permissions du certificat
|
||||
|
||||
---
|
||||
|
||||
**Temps estimé de configuration** : 2-3 heures
|
||||
**Coût** : Gratuit (500 min/mois Codemagic)
|
||||
**Prochaines publications** : ~10 minutes par build
|
||||
Reference in New Issue
Block a user