feat: Add retrieval and copying of Flutter .env file from Jenkins credentials for Android build.
This commit is contained in:
43
Jenkinsfile
vendored
43
Jenkinsfile
vendored
@@ -30,27 +30,28 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stage('Build & Deploy Android') {
|
stage('Build & Deploy Android') {
|
||||||
steps {
|
steps {
|
||||||
// On injecte les fichiers secrets temporairement
|
withCredentials([
|
||||||
withCredentials([
|
file(credentialsId: 'android-keystore-file', variable: 'KEYSTORE_PATH'),
|
||||||
file(credentialsId: 'android-keystore-file', variable: 'KEYSTORE_PATH'),
|
file(credentialsId: 'google-play-json', variable: 'GOOGLE_JSON'),
|
||||||
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 {
|
]) {
|
||||||
// 1. Créer le fichier key.properties pour Gradle
|
script {
|
||||||
// Note : Assurez-vous que votre 'keyAlias' est bien 'key0' (défaut) ou changez-le ici
|
// 2. On copie le fichier secret vers la racine du workspace sous le nom ".env"
|
||||||
sh """
|
sh 'cp $ENV_FILE_REF .env'
|
||||||
echo 'storePassword=$STORE_PASS' > android/key.properties
|
|
||||||
echo 'keyPassword=$KEY_PASS' >> android/key.properties
|
// ... Votre code existant pour key.properties ...
|
||||||
echo 'keyAlias=upload' >> android/key.properties
|
sh """
|
||||||
echo 'storeFile=$KEYSTORE_PATH' >> android/key.properties
|
echo storePassword=$STORE_PASS > android/key.properties
|
||||||
"""
|
echo keyPassword=$KEY_PASS >> android/key.properties
|
||||||
|
echo keyAlias=upload >> android/key.properties
|
||||||
// 2. Lancer Fastlane
|
echo storeFile=$KEYSTORE_PATH >> android/key.properties
|
||||||
dir('android') {
|
"""
|
||||||
// On passe le chemin du JSON via une variable d'environnement à Fastlane
|
|
||||||
sh "GOOGLE_JSON_KEY_PATH='$GOOGLE_JSON' fastlane deploy_internal"
|
// ... Lancer Fastlane ...
|
||||||
}
|
dir('android') {
|
||||||
|
sh "GOOGLE_JSON_KEY_PATH='$GOOGLE_JSON' fastlane deploy_internal"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user