-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add GitHub Actions workflow for automated releases
- Add GitHub Actions workflow for building and releasing APK/AAB - Create scripts for keystore management - Update documentation with release process - Configure gradle for environment-based signing
- Loading branch information
1 parent
9b69c1e
commit c0b19ae
Showing
9 changed files
with
322 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Android Release Signing Configuration | ||
ANDROID_STORE_PASSWORD=your_keystore_password | ||
ANDROID_KEY_ALIAS=your_key_alias | ||
ANDROID_KEY_PASSWORD=your_key_password | ||
|
||
# Note: Replace the values above with your actual keystore credentials | ||
# To use this file: | ||
# 1. Copy this file to .env | ||
# 2. Replace the placeholder values with your actual keystore credentials | ||
# 3. Make sure your release.keystore file is in android/app/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: Android Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18' | ||
cache: 'npm' | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
cache: 'gradle' | ||
|
||
- name: Cache Gradle packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Create release keystore | ||
env: | ||
RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }} | ||
run: | | ||
echo "$RELEASE_KEYSTORE" | base64 -d > android/app/release.keystore | ||
- name: Create .env file | ||
env: | ||
ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }} | ||
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} | ||
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} | ||
run: | | ||
echo "ANDROID_STORE_PASSWORD=$ANDROID_STORE_PASSWORD" > .env | ||
echo "ANDROID_KEY_ALIAS=$ANDROID_KEY_ALIAS" >> .env | ||
echo "ANDROID_KEY_PASSWORD=$ANDROID_KEY_PASSWORD" >> .env | ||
- name: Build Release APK | ||
run: | | ||
cd android | ||
./gradlew assembleRelease | ||
- name: Build Release Bundle | ||
run: | | ||
cd android | ||
./gradlew bundleRelease | ||
- name: Get version from tag | ||
id: get_version | ||
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | ||
|
||
- name: Create Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: Release ${{ steps.get_version.outputs.VERSION }} | ||
files: | | ||
android/app/build/outputs/apk/release/app-release.apk | ||
android/app/build/outputs/bundle/release/app-release.aab | ||
body: | | ||
Release ${{ steps.get_version.outputs.VERSION }} | ||
### Installation | ||
- Download and install the APK on your Android device | ||
- Alternatively, wait for the Play Store release | ||
### Note | ||
The AAB file is for Play Store submission only. For direct installation, use the APK. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
# Colors for output | ||
RED='\033[0;31m' | ||
GREEN='\033[0;32m' | ||
BLUE='\033[0;34m' | ||
NC='\033[0m' # No Color | ||
|
||
echo -e "${BLUE}Android Release Keystore Creation Script${NC}\n" | ||
|
||
# Get keystore details | ||
read -p "Enter keystore password: " STORE_PASSWORD | ||
read -p "Enter key alias (e.g., app name): " KEY_ALIAS | ||
read -p "Enter key password (can be same as keystore password): " KEY_PASSWORD | ||
read -p "Enter your name (CN): " CN | ||
read -p "Enter your organizational unit (OU): " OU | ||
read -p "Enter your organization (O): " O | ||
read -p "Enter your city/locality (L): " L | ||
read -p "Enter your state/province (ST): " ST | ||
read -p "Enter your country code (C, e.g., US): " C | ||
|
||
# Create android/app directory if it doesn't exist | ||
mkdir -p android/app | ||
|
||
# Generate the keystore | ||
keytool -genkeypair -v \ | ||
-storetype PKCS12 \ | ||
-keystore android/app/release.keystore \ | ||
-alias "$KEY_ALIAS" \ | ||
-keyalg RSA \ | ||
-keysize 2048 \ | ||
-validity 10000 \ | ||
-storepass "$STORE_PASSWORD" \ | ||
-keypass "$KEY_PASSWORD" \ | ||
-dname "CN=$CN, OU=$OU, O=$O, L=$L, ST=$ST, C=$C" | ||
|
||
# Check if keystore was created successfully | ||
if [ $? -eq 0 ]; then | ||
echo -e "\n${GREEN}Keystore created successfully at android/app/release.keystore${NC}" | ||
|
||
# Create/update .env file | ||
echo "# Android Release Signing Configuration" > .env | ||
echo "ANDROID_STORE_PASSWORD=$STORE_PASSWORD" >> .env | ||
echo "ANDROID_KEY_ALIAS=$KEY_ALIAS" >> .env | ||
echo "ANDROID_KEY_PASSWORD=$KEY_PASSWORD" >> .env | ||
|
||
echo -e "${GREEN}Environment variables written to .env file${NC}" | ||
echo -e "\n${BLUE}Keep these values safe - you'll need them for future app updates:${NC}" | ||
echo -e "Keystore password: ${GREEN}$STORE_PASSWORD${NC}" | ||
echo -e "Key alias: ${GREEN}$KEY_ALIAS${NC}" | ||
echo -e "Key password: ${GREEN}$KEY_PASSWORD${NC}" | ||
else | ||
echo -e "\n${RED}Failed to create keystore${NC}" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
# Colors for output | ||
RED='\033[0;31m' | ||
GREEN='\033[0;32m' | ||
BLUE='\033[0;34m' | ||
NC='\033[0m' # No Color | ||
|
||
KEYSTORE_PATH="android/app/release.keystore" | ||
|
||
if [ ! -f "$KEYSTORE_PATH" ]; then | ||
echo -e "${RED}Error: Keystore file not found at $KEYSTORE_PATH${NC}" | ||
echo -e "Please run 'npm run android:create-keystore' first to create the keystore." | ||
exit 1 | ||
fi | ||
|
||
echo -e "${BLUE}Encoding keystore for GitHub Secrets...${NC}" | ||
ENCODED_KEYSTORE=$(base64 -i "$KEYSTORE_PATH") | ||
|
||
echo -e "\n${GREEN}Add the following secrets to your GitHub repository:${NC}" | ||
echo -e "\n${BLUE}RELEASE_KEYSTORE:${NC}" | ||
echo "$ENCODED_KEYSTORE" | ||
|
||
if [ -f ".env" ]; then | ||
echo -e "\n${BLUE}Other required secrets from .env:${NC}" | ||
echo -e "ANDROID_STORE_PASSWORD: $(grep ANDROID_STORE_PASSWORD .env | cut -d '=' -f2)" | ||
echo -e "ANDROID_KEY_ALIAS: $(grep ANDROID_KEY_ALIAS .env | cut -d '=' -f2)" | ||
echo -e "ANDROID_KEY_PASSWORD: $(grep ANDROID_KEY_PASSWORD .env | cut -d '=' -f2)" | ||
else | ||
echo -e "\n${RED}Warning: .env file not found. Make sure to set up your signing configuration.${NC}" | ||
fi | ||
|
||
echo -e "\n${BLUE}Add these secrets in your GitHub repository:${NC}" | ||
echo "1. Go to your repository settings" | ||
echo "2. Navigate to Secrets and Variables > Actions" | ||
echo "3. Add the above values as repository secrets" |