中文版: github-actions-android-release.md
This repository already includes an Android release workflow:
- Workflow file:
/.github/workflows/android-release.yml - Trigger: push a tag such as
v0.0.1 - Release artifacts: signed 32-bit
APK, signed 64-bitAPK,AAB, andSHA256SUMS.txt - Publish target: GitHub Release
After you run commands like these:
git tag v0.0.1
git push origin v0.0.1GitHub Actions will automatically:
- Check out the repository.
- Install Node.js, Java, Android SDK, Build Tools, and NDK.
- Run
npm ci. - Derive the Android version from the tag.
- Rebuild the signing keystore from GitHub Secrets.
- Build signed 32-bit and 64-bit release
APKoutputs, plus the releaseAAB. - Generate
SHA256SUMS.txt. - Create or update the matching GitHub Release and upload the artifacts.
The workflow listens to v* tags, but it also validates the version format before building.
The tag must use a three-part numeric version:
v0.0.1v0.1.0v1.2.3
Anything outside that format will fail the workflow.
The workflow derives:
versionName = tag without the leading vversionCode = major * 1000000 + minor * 1000 + patch
Examples:
v0.0.1->versionName = 0.0.1,versionCode = 1v1.2.3->versionName = 1.2.3,versionCode = 1002003
Go to:
Settings -> Secrets and variables -> Actions -> New repository secret
Create these 4 repository secrets:
ANDROID_KEYSTORE_BASE64ANDROID_KEYSTORE_PASSWORDANDROID_KEY_ALIASANDROID_KEY_PASSWORD
Your local keystore path is:
E:\key\fileFlash.jks
Run this in PowerShell:
[Convert]::ToBase64String([IO.File]::ReadAllBytes('E:\key\fileFlash.jks')) | Set-ClipboardThat copies the full Base64 string into your clipboard. Paste it into the ANDROID_KEYSTORE_BASE64 secret.
If you prefer writing it to a file first:
[Convert]::ToBase64String([IO.File]::ReadAllBytes('E:\key\fileFlash.jks')) | Out-File -Encoding ascii .\fileFlash.jks.base64The workflow reconstructs the keystore on the runner with:
printf '%s' "${ANDROID_KEYSTORE_BASE64}" | base64 --decode > "${RUNNER_TEMP}/fileflash-release.jks"This means:
- the
.jksfile does not need to be committed - the keystore exists only during the CI run
- the runner is discarded after the build
The workflow currently uses:
- Node.js
22.13.0 - Java
17 - Android Platform
android-36 - Build Tools
36.0.0 - NDK
27.1.12297006
The workflow uploads these files to GitHub Release:
android/app/build/outputs/apk/release/app-armeabi-v7a-release.apkandroid/app/build/outputs/apk/release/app-arm64-v8a-release.apkandroid/app/build/outputs/bundle/release/app-release.aabandroid/app/build/outputs/SHA256SUMS.txt
If the tag is not in vX.Y.Z format, the version parsing step will fail.
If any keystore or password secret is missing, the signed Android build will fail.
If ANDROID_KEYSTORE_BASE64 is incomplete or truncated, the decoded keystore will be invalid and signing will fail.
Before creating a release tag, it is worth confirming:
- the intended version is consistent with your release plan
- Android builds successfully at least once locally
- all 4 GitHub Secrets are configured correctly
- the tag uses the final release version, for example
v0.0.1