Play Store Uploads with Fastlane Supply: Part 4
Getting an Android app from a local build to Google Play often involves a surprising amount of repetitive work.
You need to build the correct artifact, manage versioning, authenticate with Google Play, choose the right release track, and eventually upload the application. As the number of releases increases, these manual steps become both time-consuming and error-prone.
This is where Fastlane Supply becomes useful.
Supply is Fastlane's Android tool for interacting with the Google Play Store. It allows you to automate application uploads and several parts of your Play Store release workflow directly from your Fastfile.
In this part of the series, we'll build on the workflow from Part 3 and look at how to automate Google Play uploads, release tracks, version codes, metadata, and deployment.
Step 1: Set Up Google Play API Access
Before Fastlane can communicate with Google Play, it needs to authenticate with the Google Play Developer API.
A typical setup consists of creating a Google Cloud project, enabling the required API, creating a service account, generating credentials, and then granting that service account access to your application in the Google Play Console.
1. Create or Select a Google Cloud Project
- Open the Google Cloud Console.
- Create a new project or select an existing project that you want to use for Play Store automation.
2. Enable the Google Play Developer API
Inside Google Cloud, locate the Google Play Android Developer API and enable it for your project.
This allows your automation workflow to communicate with Google Play through Google's developer APIs.
3. Create a Service Account
- Open IAM & Admin → Service Accounts.
- Create a service account for your deployment workflow.
- Create credentials for the service account.
- Download the JSON credentials file.
Creating the service account is not enough. The service account must also be granted the appropriate permissions in the Google Play Console before Fastlane can perform operations on your application.
4. Keep the Credentials Secure
Your service-account JSON file contains sensitive credentials. Never commit it directly to Git.
For local development, keep the credential outside your repository. For CI/CD, use your CI platform's encrypted secret management instead of storing the JSON file directly in source control.
Step 2: Configure Fastlane Supply
Once Google Play API access has been configured, Fastlane can use upload_to_play_store to upload your Android application.
upload_to_play_store
The action can be used by itself, but in a real Android release workflow it is usually combined with Gradle so that Fastlane first creates the release artifact and then uploads it.
A Basic Release Lane
A simple release lane could look like this:
platform :android do
desc "Build the app and upload it to the Play Store"
lane :release do
gradle(
task: "bundle",
build_type: "Release"
)
upload_to_play_store
end
end
For Google Play distribution, the Android App Bundle (.aab) is generally the preferred release artifact. If your workflow specifically requires an APK, you can use the appropriate Gradle assemble task instead.
Step 3: Control Where the Release Goes
Uploading an application is only part of a release strategy. Google Play provides multiple release tracks that allow you to control how your application reaches users.
Common tracks include:
- Internal testing
- Closed testing
- Open testing
- Production
Fastlane allows you to specify the destination using the track parameter.
upload_to_play_store(
track: "beta"
)
This makes it possible to create separate deployment lanes for different environments.
platform :android do
desc "Upload to Play Store Beta"
lane :beta do
gradle(
task: "bundle",
build_type: "Release"
)
upload_to_play_store(
track: "beta"
)
end
desc "Upload to Play Store Production"
lane :production do
gradle(
task: "bundle",
build_type: "Release"
)
upload_to_play_store(
track: "production"
)
end
end
A mature pipeline does not necessarily deploy every build directly to production. You can progressively promote builds through testing tracks before releasing them to production.
Step 4: Automate Version Code Management
Android releases require a unique and increasing versionCode. When releases are created frequently, manually maintaining this value becomes another repetitive part of the release process.
Fastlane provides the increment_version_code action to automate this step.
platform :android do
desc "Increment version code, build and upload"
lane :release do
increment_version_code
gradle(
task: "bundle",
build_type: "Release"
)
upload_to_play_store(
track: "production"
)
end
end
Uploading an artifact with upload_to_play_store does not automatically
mean that Fastlane will increment your versionCode. If you want Fastlane to modify
the versionCode, explicitly include increment_version_code or use another
versioning strategy.
Step 5: Trigger the Release
Once your Fastfile and Google Play authentication are configured, the release workflow can be triggered with a single command:
fastlane release
Depending on the lane you've created, Fastlane can then:
- Increment the version code.
- Build the release AAB.
- Authenticate with Google Play.
- Upload the artifact to the configured track.
If you created separate lanes for different environments, you can trigger them independently.
fastlane beta
or
fastlane production
Step 6: Automate Play Store Metadata
The application binary is only one part of a Play Store release. A production release can also contain descriptions, release notes, screenshots, localized content, and other store metadata.
Keeping this information under version control makes the release process more reproducible and easier to automate.
Fastlane can work with Play Store metadata as part of your release workflow. For example:
upload_to_play_store(
metadata_path: "./metadata"
)
This approach allows your store metadata to live alongside your release automation rather than requiring every release to be prepared manually through the Play Console.
Metadata automation becomes especially valuable when Fastlane runs inside CI/CD. Your repository can become the source of truth for the release configuration, while the pipeline performs the repetitive deployment work.
🚀 Putting Everything Together
By combining the pieces we've covered, your Android release workflow can look like this:
Developer
↓
Fastlane
↓
Run tests
↓
Increment versionCode
↓
Build Release AAB
↓
Authenticate with Google Play
↓
Upload to Internal / Beta / Production
↓
Release
A Practical Release Lane
Bringing the core concepts together, a simple production-oriented lane could look like this:
platform :android do
desc "Build and deploy Android app"
lane :deploy do
increment_version_code
gradle(
task: "bundle",
build_type: "Release"
)
upload_to_play_store(
track: "production"
)
end
end
Wrapping Up
With Fastlane Supply, the Play Store no longer needs to be a completely manual step in your Android release process.
You can automate the journey from building your application to selecting a release track and uploading the final artifact. You can also bring version management and Play Store metadata into the same automation workflow.
The bigger idea is not simply uploading an AAB with one command. It's about making the release process repeatable, predictable, and automation-friendly.
And when this workflow moves into CI/CD, Fastlane becomes an important automation layer between your Android build system and Google Play.
In the next part, we'll move beyond the application binary and automate another time-consuming part of Android releases: generating and managing screenshots with Screengrab. 🚀
LinkedIn: https://www.linkedin.com/in/vikas-soni-052013160/
Email: vikasacsoni9211@gmail.com
📚 Fastlane Android Series
Introduction to Fastlane in Android — Part 1
Setting Up Fastlane in an Android Project — Part 2
Automating Build and Release Process in Fastlane — Part 3
Play Store Uploads with Fastlane Supply — Part 4
Automating Screenshot Generation with Screengrab — Part 5
Comments
Post a Comment