Developer Documentation โ GitHub Actions: Release Bundle with Tag, Cache, and Version Bump
๐ Overview
This workflow automates the release process for the Android app. It performs the following tasks:
- Checks out the repository and sets up the Java environment.
- Caches Gradle dependencies to speed up builds.
- Decodes the Keystore from GitHub Secrets (used for signing builds).
- Reads and bumps the app version in
version.properties
. - Commits version changes, tags the release, and pushes tags.
- Builds both AAB and APK artifacts (signed).
- Uploads artifacts to GitHub Actions for download.
- Creates a GitHub Release with the artifacts attached.
โ๏ธ Workflow File Location
.github/workflows/release.yml
๐ ๏ธ Trigger
on:
workflow_dispatch:
- This workflow runs manually via the GitHub Actions UI.
- Useful for controlled releases (instead of automatic CI/CD builds).
๐ Environment Variables / Secrets
The following GitHub Secrets must be set in your repository:
Secret Name | Description |
---|---|
KEYSTORE_FILE |
Base64-encoded keystore file. |
KEYSTORE_PASSWORD |
Password for the keystore. |
SIGNING_KEY_ALIAS |
Alias of the signing key. |
SIGNING_KEY_PASSWORD |
Password for the signing key. |
GITHUB_TOKEN |
Default GitHub Actions token (used for commits, tags, and releases). |
๐ Steps Breakdown
1. Checkout Code
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for tagging
- Fetches the entire repo (not shallow), so tags and history are available.
2. Set Up JDK
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- Configures Java 17 (Temurin distribution) for Gradle builds.
3. Setup Gradle Cache
- name: Setup Gradle cache
uses: gradle/actions/setup-gradle@v3
- Speeds up builds by caching Gradle dependencies.
4. Decode Keystore
- name: Decode Keystore
run: echo "$KEYSTORE_FILE" | base64 -d > app/playstore.keystore.jks
- Converts the base64 keystore secret into a physical
.jks
file required for signing.
5. Read and Bump Version
- name: Read and Bump Version
id: versioning
run: |
FILE=version.properties
VERSION=$(grep VERSION_NAME $FILE | cut -d '=' -f2)
...
- Reads
VERSION_NAME
fromversion.properties
. - Bumps patch version (e.g.,
1.2.3 โ 1.2.4
). - Commits changes to
main
. - Creates a Git tag
vX.Y.Z
. - Pushes commit + tags to origin.
โ ๏ธ This modifies your repo during workflow execution, so version history is always updated alongside releases.
6. Build AAB & APK
./gradlew bundleRelease ...
./gradlew assembleRelease ...
- Builds signed App Bundle (.aab) and APK (.apk).
- Uses keystore + signing configs from environment variables.
7. Upload Artifacts
- name: Upload AAB Artifact
uses: actions/upload-artifact@v4
with:
name: release-aab
path: app/build/outputs/bundle/release/*.aab
- Makes AAB and APK files available for download in GitHub Actions.
8. Create GitHub Release
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.versioning.outputs.version }}
name: Release v${{ steps.versioning.outputs.version }}
-
Publishes a new GitHub Release with:
-
Correct tag (
vX.Y.Z
). - Release notes title (e.g.,
Release v1.2.4
). - Attached APK and AAB artifacts.
๐ Artifacts
After a successful run, you will find:
-
In GitHub Actions (workflow run) โ
-
release-aab
: App Bundle for Play Store. release-apk
: Signed APK.-
In GitHub Releases (repository) โ
-
APK + AAB files attached to the tagged release.
๐ฎ Future Improvements
- Add automatic changelog generation from commit messages.
- Support version bump strategies (major, minor, patch).
- Upload artifacts directly to Google Play Console (using gradle-play-publisher).
- Add matrix builds (different flavors/variants).