From 73db84896a80dfb17dd3d965cb5584d5f75d0073 Mon Sep 17 00:00:00 2001 From: Van Leemput Dayron Date: Mon, 8 Dec 2025 18:04:42 +0100 Subject: [PATCH] feat: Migrate Android deployment from Jenkins and Fastlane to Gitea Actions workflow. --- .gitea/workflows/deploy-android.yaml | 61 +++++++++++++++++++++++++ Jenkinsfile | 68 ---------------------------- android/fastlane/Appfile | 2 - android/fastlane/Fastfile | 16 ------- 4 files changed, 61 insertions(+), 86 deletions(-) create mode 100644 .gitea/workflows/deploy-android.yaml delete mode 100644 Jenkinsfile delete mode 100644 android/fastlane/Appfile delete mode 100644 android/fastlane/Fastfile diff --git a/.gitea/workflows/deploy-android.yaml b/.gitea/workflows/deploy-android.yaml new file mode 100644 index 0000000..19dd9ff --- /dev/null +++ b/.gitea/workflows/deploy-android.yaml @@ -0,0 +1,61 @@ +name: Deploy Android to Play Store +run-name: Deploy ${{ gitea.actor }} to Internal Track 🚀 + +on: + push: + branches: + - release # Se dĂ©clenche uniquement sur la branche release + +jobs: + build-and-deploy: + runs-on: ubuntu-latest # Le runner Gitea standard + steps: + # 1. RĂ©cupĂ©rer le code + - name: Checkout code + uses: actions/checkout@v3 + + # 2. Installer Java + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '17' + + # 3. Installer Flutter + - name: Setup Flutter + uses: subosito/flutter-action@v2 + with: + channel: 'stable' + flutter-version: '3.19.0' # Mettez votre version prĂ©fĂ©rĂ©e ou laissez vide pour 'any' + + # 4. RĂ©cupĂ©rer les dĂ©pendances + - name: Flutter Pub Get + run: flutter pub get + + # 5. Reconstruire le Keystore depuis le Secret Base64 + - name: Decode Keystore + run: | + echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > android/app/upload-keystore.jks + + # 6. CrĂ©er le fichier key.properties + - name: Create key.properties + run: | + echo "storePassword=${{ secrets.KEYSTORE_PASSWORD }}" > android/key.properties + echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties + echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties + echo "storeFile=upload-keystore.jks" >> android/key.properties + + # 7. Compiler l'AppBundle (.aab) + - name: Build AppBundle + run: flutter build appbundle --release + + # 8. Envoyer sur le Play Store + # Cette action remplace Fastlane manuel, c'est plus simple dans Gitea + - name: Upload to Play Store + uses: r0adkll/upload-google-play@v1 + with: + serviceAccountJsonPlainText: ${{ secrets.PLAY_STORE_JSON }} + packageName: be.devdayronvl.travel_mate + releaseFiles: build/app/outputs/bundle/release/app-release.aab + track: internal # 'internal' = Test interne, 'alpha' = Test fermĂ© + status: completed \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 8b81961..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,68 +0,0 @@ -pipeline { - agent any - - environment { - ANDROID_HOME = "${env.HOME}/android-sdk" - - // Chemin confirmĂ© par votre capture d'Ă©cran - JAVA_HOME = "/usr/lib/jvm/java-17-openjdk-amd64" - - // ✅ On Ă©crit le chemin complet ici aussi pour ĂȘtre 100% sĂ»r - PATH = "/usr/lib/jvm/java-17-openjdk-amd64/bin:/usr/local/bin:/opt/flutter/bin:${env.HOME}/android-sdk/cmdline-tools/latest/bin:${env.HOME}/android-sdk/platform-tools:${env.PATH}" - - STORE_PASS = credentials('android-store-pass') - KEY_PASS = credentials('android-key-pass') - } - - stages { - stage('Checkout') { - steps { - // RĂ©cupĂšre le code depuis Gitea - checkout scm - } - } - - stage('Setup Dependencies') { - steps { - sh 'flutter config --no-analytics' - sh 'flutter pub get' - } - } - - stage('Build & Deploy Android') { - steps { - withCredentials([ - file(credentialsId: 'android-keystore-file', variable: 'KEYSTORE_PATH'), - file(credentialsId: 'google-play-json', variable: 'GOOGLE_JSON'), - // 1. On rĂ©cupĂšre le fichier .env stockĂ© dans Jenkins - file(credentialsId: 'flutter-env-file', variable: 'ENV_FILE_REF') - ]) { - script { - // 2. On copie le fichier secret vers la racine du workspace sous le nom ".env" - sh 'cp $ENV_FILE_REF .env' - - // ... Votre code existant pour key.properties ... - sh """ - echo storePassword=$STORE_PASS > android/key.properties - echo keyPassword=$KEY_PASS >> android/key.properties - echo keyAlias=upload >> android/key.properties - echo storeFile=$KEYSTORE_PATH >> android/key.properties - """ - - // ... Lancer Fastlane ... - dir('android') { - sh "GOOGLE_JSON_KEY_PATH='$GOOGLE_JSON' fastlane deploy_internal" - } - } - } - } - } - } - - post { - always { - // SĂ©curitĂ© : On supprime le fichier contenant les mots de passe - sh 'rm -f android/key.properties' - } - } -} \ No newline at end of file diff --git a/android/fastlane/Appfile b/android/fastlane/Appfile deleted file mode 100644 index 74f9886..0000000 --- a/android/fastlane/Appfile +++ /dev/null @@ -1,2 +0,0 @@ -json_key_file(ENV["GOOGLE_PLAY_JSON_KEY_FILE"]) # Path to the json secret file - defined in Jenkins -package_name("be.devdayronvl.travel_mate") # Your package name diff --git a/android/fastlane/Fastfile b/android/fastlane/Fastfile deleted file mode 100644 index 74cbc6e..0000000 --- a/android/fastlane/Fastfile +++ /dev/null @@ -1,16 +0,0 @@ -default_platform(:android) - -platform :android do - desc "Deploy to Internal Testing" - lane :deploy_internal do - # Build de l'application - sh "cd ../.. && flutter build appbundle --release" - - # Upload vers Google Play - upload_to_play_store( - track: 'internal', # 'internal' = Test interne, 'alpha' = Test fermĂ© - aab: '../build/app/outputs/bundle/release/app-release.aab', - json_key: ENV['GOOGLE_JSON_KEY_PATH'] # Jenkins remplit cette variable magiquement - ) - end -end \ No newline at end of file