diff --git a/.github/workflows/deploy-playstore.yml b/.github/workflows/deploy-playstore.yml new file mode 100644 index 0000000..4c43ed1 --- /dev/null +++ b/.github/workflows/deploy-playstore.yml @@ -0,0 +1,55 @@ +name: Deploy to Play Store + +on: + push: + branches: + - release # L'action se déclenche uniquement sur la branche 'release' + +jobs: + build_and_deploy: + runs-on: ubuntu-latest + + steps: + # 1. Récupérer le code + - uses: actions/checkout@v4 + + # 2. Installer Java (requis pour Android build) + - uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '17' + + # 3. Installer Flutter + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' + + # 4. Gérer les dépendances + - run: flutter pub get + + # 5. Créer le Keystore depuis le secret (Décodage) + - name: Decode Keystore + run: | + echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > android/app/upload-keystore.jks + + # 6. Créer le fichier key.properties pour que Gradle trouve la clé + - name: Create key.properties + run: | + echo "storePassword=${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" > android/key.properties + echo "keyPassword=${{ secrets.ANDROID_KEY_PASSWORD }}" >> android/key.properties + echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" >> android/key.properties + echo "storeFile=upload-keystore.jks" >> android/key.properties + + # 7. Construire l'AppBundle (.aab) + - name: Build AppBundle + run: flutter build appbundle --release + + # 8. Uploader sur le Play Store (Track: alpha = Test fermé) + - name: Upload to Play Store + uses: r0adkll/upload-google-play@v1 + with: + serviceAccountJsonPlainText: ${{ secrets.PLAY_STORE_CONFIG_JSON }} + packageName: be.devdayronvl.travel_mate + releaseFiles: build/app/outputs/bundle/release/app-release.aab + track: alpha # 'alpha' correspond souvent au Test Fermé. Sinon 'internal' ou 'beta'. + status: completed \ No newline at end of file