-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (68 loc) · 2.98 KB
/
cd-ios.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Continuous Delivery iOS
on:
workflow_call:
inputs:
FLAVOR:
type: string
required: true
secrets:
IOS_P12_FILE:
required: true
IOS_P12_PASSWORD:
required: true
IOS_PROFILE:
required: true
IOS_EXPORT_OPTIONS:
required: true
IOS_USERNAME:
required: true
IOS_PASSWORD:
required: true
FLUTTER_ENV:
required: true
jobs:
continuous_delivery_ios:
runs-on: macos-latest
steps:
- name: 📚 Git checkout
uses: actions/checkout@v4
- name: 🗒️🔏 Ajouter le certificat de signature
run: |
keychainPassword=$(openssl rand -base64 50)
security create-keychain -p "$keychainPassword" temp.keychain
security set-keychain-settings -lut 21600 temp.keychain
security unlock-keychain -p "$keychainPassword" temp.keychain
echo "${{ secrets.IOS_P12_FILE }}" | base64 --decode > certificat.p12
security import certificat.p12 -P "${{ secrets.IOS_P12_PASSWORD }}" -A -t cert -f pkcs12 -k temp.keychain
security list-keychain -d user -s temp.keychain
security set-key-partition-list -S apple-tool:,apple: -s -k "$keychainPassword" temp.keychain
- name: 📱🔏 Ajouter le profil de provisionnement et le fichier exportOptions
run: |
echo ${{ secrets.IOS_PROFILE }} | base64 --decode > profile.mobileprovision
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp profile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/profile.mobileprovision
echo ${{ secrets.IOS_EXPORT_OPTIONS }} | base64 --decode > exportOptions.plist
- name: 🐦 Installer flutter
uses: subosito/flutter-action@v2
with:
cache: true
channel: stable
flutter-version-file: app/pubspec.yaml
- name: 🔑 Ajouter les variables d'environnements
working-directory: app
run: echo "${{ secrets.FLUTTER_ENV }}" | base64 --decode > env.json
- name: 🧱 Construire l'application
working-directory: app
run: flutter build ipa --flavor ${{ inputs.FLAVOR }} --export-options-plist ../exportOptions.plist --dart-define-from-file env.json --build-number ${GITHUB_RUN_NUMBER}
- name: 📦 Télécharger artifact
uses: actions/upload-artifact@v4
with:
name: app_${{ inputs.FLAVOR }}_ios
path: app/build/ios/ipa/app-${{ inputs.FLAVOR }}-release.ipa
- name: 🚀 Publier sur TestFlight
run: xcrun altool --upload-app -t ios -f app/build/ios/ipa/app-${{ inputs.FLAVOR }}-release.ipa -u ${{ secrets.IOS_USERNAME }} -p ${{ secrets.IOS_PASSWORD }}
- name: 🗑️ Nettoyer les fichiers secrets
if: always()
run: |
rm -f certificat.p12 profile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/profile.mobileprovision exportOptions.plist app/env.json
security delete-keychain temp.keychain