android_cd plugin
Getting Started
This project is a fastlane plugin. To get started with fastlane-plugin-android_cd
, add the dependencies into your PluginFile
:
gem "fastlane-plugin-android_cd", git: "https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-fastlane-plugins.git", branch: "main", glob: 'plugins/fastlane-plugin-android_cd/*.gemspec'
About android_cd
Google Play Store deployment plugin for Fastlane, simplifying the build and deployment process to internal, beta, alpha, and production channels, and promoting builds for testing.
Usage
This plugin provides two actions that allow you to build, deploy and promote your Flutter Android applications to a new beta test release.
To use these actions, you need to add some information to your Android folder so that the actions can run correctly.
In your android folder, place a compressed folder containing:
- The application's signing key (in the .jks format). If this is a new application, you can generate this key with the following command:
keytool -genkey -v -keystore key_store_name.keystore -alias key_alias_name -keyalg RSA -keysize 2048 -validity 10000
During the execution of the above command, you will be prompted to provide a password for your key. Make sure to remember this password, as you will need it later.
-
The key.properties file containing sensitive data for using the signing key, such as the path of the key or the password. If this file does not exist yet, create it and fill in the following fields:
storeFile
: the relative or absolute path to the key storage file that contains the private key used to sign the Android application.storePassword
: the password used to access the key storage file.keyAlias
: the alias of the key used to sign the application.keyPassword
: the password used to access the key.
-
The credentials in JSON format to allow the fastlane action to connect to the Google Play Store console and upload the new build. To retrieve them, follow these steps:
- Go to your Google Play Store console.
- In the Settings menu, select
API access
, then clickCreate Service Account
- Navigate to the provided Google Developers Console link in the dialog
- Click
Create Service Account
at the top of the Google Developers Console - Provide the required details, then click
Create
- Click
Select a role
, selectService Accounts
, then clickService Account User
- In the Service Accounts dashboard, navigate to the Actions column, tap the menu for the service account that you created, then click
Create Key
- Select JSON as the key type, then click
Save
- Back on the Google Play Console, click
Done
to close the dialog - Click on
Grant Access
for the newly added service account - Make sure that the role of this service account has the permission to upload builds
- Click
Add User
to close the dialog
Once you have all three elements in your folder, it's time to encrypt them. Indeed, this folder contains elements that are too sensitive to be referenced on git.
Place them in a folder named android_keys
and compress it using the following command:
jar cfvM android_keys.zip android_keys
The plugin will use
jar xvf android/android_keys.zip && mv android/android_keys/* android/
to extract the secret files.
Then, encrypt the compressed folder using GPG.
gpg --quiet --batch --yes --symmetric --passphrase="<android-key-passphrase>" --output android/android_keys.zip.gpg android/android_keys.zip
Note that the passphrase will be the only secret to add to your repository for continuous deployment. This data is very important. If you lose the passphrase, you will not be able to sign your application and update it on the Google Play Store.
Once your folder is compressed, encrypted, and placed in the android folder of your project, you can call the actions of this plugin in your various lanes.
Build and Deploy
build_and_deploy(beta_type: "internal")
Promote
promote(from: "internal", destination: "beta")
note that beta type can be production
, beta
, alpha
, internal
.
Run tests for this plugin
To run both the tests, and code style validation, run
rake
To automatically fix many of the styling issues, use
rubocop -a
Issues and Feedback
For any other issues and feedback about this plugin, please submit it to this repository.