docs: update readme (#1)

This commit is contained in:
Malo Léon 2023-04-26 12:27:43 +02:00
parent bd46322ab3
commit e4246e7692
2 changed files with 51 additions and 22 deletions

View File

@ -1,26 +1,66 @@
# android_cd plugin # android_cd plugin
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-android_cd) [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-fastlane-plugins)
## Getting Started ## Getting Started
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-android_cd`, add it to your project by running: This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-android_cd`, add the dependencies into your `PluginFile` :
```bash ```ruby
fastlane add_plugin android_cd 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 build_and_deploy ## 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. 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.
**Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here. ## Usage
## Example This plugin provides two actions that allow you to build, deploy and promote your Flutter Android applications to a new beta test release.
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`. To use these actions, you need to add some information to your Android folder so that the actions can run correctly.
**Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary) 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:
```shel
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 click `Create 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`, select `Service Accounts`, then click `Service 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. Compress the folder, place the compressed folder in the android folder of your Flutter project, and execute the following command:
```shell
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.
## Run tests for this plugin ## Run tests for this plugin
@ -39,15 +79,3 @@ rubocop -a
## Issues and Feedback ## Issues and Feedback
For any other issues and feedback about this plugin, please submit it to this repository. For any other issues and feedback about this plugin, please submit it to this repository.
## Troubleshooting
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
## Using _fastlane_ Plugins
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
## About _fastlane_
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).

View File

@ -3,7 +3,7 @@ require_relative '../helper/android_cd_helper'
module Fastlane module Fastlane
module Actions module Actions
class BuildAndDeployAction < Action class PromoteAction < Action
def self.run(params) def self.run(params)
# Check from parameters # Check from parameters
unless Helper::AndroidCdHelper.is_set(params[:from]) unless Helper::AndroidCdHelper.is_set(params[:from])
@ -11,6 +11,7 @@ module Fastlane
puts("Error on beta type parameter") puts("Error on beta type parameter")
end end
# Check destination parameters
unless Helper::AndroidCdHelper.is_set(params[:destination]) unless Helper::AndroidCdHelper.is_set(params[:destination])
UI.error("❌ Parameters destination cannot be null") UI.error("❌ Parameters destination cannot be null")
puts("Error on beta type parameter") puts("Error on beta type parameter")