feat: Migrate Android deployment from Jenkins and Fastlane to Gitea Actions workflow.
Some checks failed
Deploy Android to Play Store / build-and-deploy (push) Failing after 4m10s
Some checks failed
Deploy Android to Play Store / build-and-deploy (push) Failing after 4m10s
This commit is contained in:
61
.gitea/workflows/deploy-android.yaml
Normal file
61
.gitea/workflows/deploy-android.yaml
Normal file
@@ -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
|
||||||
68
Jenkinsfile
vendored
68
Jenkinsfile
vendored
@@ -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'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
Reference in New Issue
Block a user