google_play_track_updater plugin
Getting Started
This project is a fastlane plugin. To get started with fastlane-plugin-google_play_track_updater, add it to your project by running:
# to Gemfile
bundle add 'fastlane-plugin-google_play_track_updater'# to Pluginfile
fastlane add_plugin google_play_track_updaterAbout google_play_track_updater
A fastlane plugin for managing Google Play release tracks. This plugin provides three actions to control release statuses and rollout fractions:
-
halt_google_play_release- Halts an active staged rollout or completed release -
resume_google_play_release- Resumes a halted release -
update_google_play_release_rollout- Updates the rollout percentage for a staged rollout
Motivation
While supply can also change release statuses, it requires many configuration parameters which can lead to unintended side effects. This plugin provides dedicated actions for each specific operation, making release management more explicit and manageable.
By using focused actions like halt_google_play_release, resume_google_play_release, and update_google_play_release_rollout, you can:
- Clearly express your intent in your Fastfile
- Reduce the risk of accidentally modifying other release properties
- Simplify your CI/CD pipelines with purpose-built commands
Authentication
This plugin supports multiple authentication methods. The priority order is:
-
GOOGLE_APPLICATION_CREDENTIALSenvironment variable (Highest priority) json_file_pathparameterjson_key_dataparameter
If GOOGLE_APPLICATION_CREDENTIALS is set, it will be used regardless of whether json_file_path or json_key_data are provided. This makes it convenient to use with tools like google-github-actions/auth which automatically sets this environment variable.
Actions
halt_google_play_release
Halts an active staged rollout or completed release for a specific version on a Google Play track.
halt_google_play_release(
package_name: "com.example.app",
track: "production",
version_name: "1.0.0",
json_file_path: "path/to/service-account.json"
)Parameters:
| Key | Environment Variable | Description | Required | Type |
|---|---|---|---|---|
package_name |
HALT_GOOGLE_PLAY_RELEASE_PACKAGE_NAME |
The package name of the application (e.g., 'com.example.app') | Yes | String |
track |
HALT_GOOGLE_PLAY_RELEASE_TRACK |
The track of the application (production, beta, alpha, internal) | Yes | String |
version_name |
HALT_GOOGLE_PLAY_RELEASE_VERSION_NAME |
The version name to halt (e.g., '1.0.0') | Yes | String |
json_file_path |
HALT_GOOGLE_PLAY_RELEASE_JSON_FILE_PATH |
Path to a file containing service account or external account JSON | No* | String |
json_key_data |
HALT_GOOGLE_PLAY_RELEASE_JSON_KEY_DATA |
Service account or external account JSON data as a string | No* | String |
* Either json_file_path, json_key_data, or GOOGLE_APPLICATION_CREDENTIALS environment variable must be provided
resume_google_play_release
Resumes a halted staged rollout for a specific version on a Google Play track. The status will change from 'halted' to either 'completed' (if no user_fraction is set) or 'inProgress' (if user_fraction is set for staged rollout).
resume_google_play_release(
package_name: "com.example.app",
track: "production",
version_name: "1.0.0",
json_file_path: "path/to/service-account.json"
)Parameters:
| Key | Environment Variable | Description | Required | Type |
|---|---|---|---|---|
package_name |
RESUME_GOOGLE_PLAY_RELEASE_PACKAGE_NAME |
The package name of the application (e.g., 'com.example.app') | Yes | String |
track |
RESUME_GOOGLE_PLAY_RELEASE_TRACK |
The track of the application (production, beta, alpha, internal) | Yes | String |
version_name |
RESUME_GOOGLE_PLAY_RELEASE_VERSION_NAME |
The version name to resume (e.g., '1.0.0') | Yes | String |
json_file_path |
RESUME_GOOGLE_PLAY_RELEASE_JSON_FILE_PATH |
Path to a file containing service account or external account JSON | No* | String |
json_key_data |
RESUME_GOOGLE_PLAY_RELEASE_JSON_KEY_DATA |
Service account or external account JSON data as a string | No* | String |
* Either json_file_path, json_key_data, or GOOGLE_APPLICATION_CREDENTIALS environment variable must be provided
update_google_play_release_rollout
Updates the rollout percentage for a staged rollout on a Google Play track. Only updates releases with 'inProgress' status.
update_google_play_release_rollout(
package_name: "com.example.app",
track: "production",
version_name: "1.0.0",
user_fraction: 0.5, # 50% rollout
json_file_path: "path/to/service-account.json"
)Parameters:
| Key | Environment Variable | Description | Required | Type |
|---|---|---|---|---|
package_name |
UPDATE_GOOGLE_PLAY_RELEASE_ROLLOUT_PACKAGE_NAME |
The package name of the application (e.g., 'com.example.app') | Yes | String |
track |
UPDATE_GOOGLE_PLAY_RELEASE_ROLLOUT_TRACK |
The track of the application (production, beta, alpha, internal) | Yes | String |
version_name |
UPDATE_GOOGLE_PLAY_RELEASE_ROLLOUT_VERSION_NAME |
The version name to update (e.g., '1.0.0') | Yes | String |
user_fraction |
UPDATE_GOOGLE_PLAY_RELEASE_ROLLOUT_USER_FRACTION |
The rollout percentage as a fraction (0.0 to 1.0, exclusive). e.g., 0.1 for 10% rollout | Yes | Float |
json_file_path |
UPDATE_GOOGLE_PLAY_RELEASE_ROLLOUT_JSON_FILE_PATH |
Path to a file containing service account or external account JSON | No* | String |
json_key_data |
UPDATE_GOOGLE_PLAY_RELEASE_ROLLOUT_JSON_KEY_DATA |
Service account or external account JSON data as a string | No* | String |
* Either json_file_path, json_key_data, or GOOGLE_APPLICATION_CREDENTIALS environment variable must be provided
Example
Here are examples of how to use each action in your Fastfile:
lane :halt_release do
halt_google_play_release(
package_name: "com.example.app",
track: "production",
version_name: "1.0.0",
json_file_path: "path/to/service-account.json"
)
end
lane :resume_release do
resume_google_play_release(
package_name: "com.example.app",
track: "production",
version_name: "1.0.0",
json_file_path: "path/to/external-account.json"
)
end
lane :update_rollout do
update_google_play_release_rollout(
package_name: "com.example.app",
track: "production",
version_name: "1.0.0",
user_fraction: 0.5,
json_file_path: "path/to/service-account.json"
)
endUsing with GitHub Actions and Workload Identity Provider
Since fastlane 2.230.0, you can use Workload Identity Provider for keyless authentication with Google Cloud. Here's an example workflow:
name: Halt Release
on:
workflow_dispatch:
inputs:
version_name:
description: 'Version name to halt (e.g., 1.0.0)'
required: true
type: string
jobs:
halt_release:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
bundler-cache: true
- id: auth
uses: google-github-actions/auth@v3
with:
create_credentials_file: true
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
- name: Halt release
env:
# google-github-actions/auth with create_credentials_file: true sets GOOGLE_APPLICATION_CREDENTIALS
# You can also inject required params via HALT_GOOGLE_PLAY_RELEASE_{PACKAGE_NAME,TRACK,VERSION_NAME}
HALT_GOOGLE_PLAY_RELEASE_PACKAGE_NAME: com.example.app
HALT_GOOGLE_PLAY_RELEASE_TRACK: production
HALT_GOOGLE_PLAY_RELEASE_VERSION_NAME: ${{ inputs.version_name }}
run: bundle exec fastlane halt_releaselane :halt_release do
# Params are injected from HALT_GOOGLE_PLAY_RELEASE_{PACKAGE_NAME,TRACK,VERSION_NAME}
# GOOGLE_APPLICATION_CREDENTIALS is set by google-github-actions/auth
halt_google_play_release
# You can also specify directly
# halt_google_play_release(
# package_name: ENV['YOUR_PACKAGE_NAME_ENVIRONMENT_NAME'],
# version_name: "1.0.0",
# json_file_path: "path/to/service-account.json"
#)
endRun 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.
Troubleshooting
If you have trouble using plugins, check out the Plugins Troubleshooting guide.
Using fastlane Plugins
For more information about how the fastlane plugin system works, check out the Plugins documentation.
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.