Skip to content

Commit 238700f

Browse files
committed
feat: update version to 2.2.7 and add documentation for GitHub Action workflows and local build scripts
1 parent e63b511 commit 238700f

2 files changed

Lines changed: 213 additions & 1 deletion

File tree

README.md

Lines changed: 213 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
## Version Release
2929
This Is Latest Release
3030

31-
$version_release = 2.2.6
31+
$version_release = 2.2.7
3232

3333
What's New??
3434

@@ -37,6 +37,8 @@ What's New??
3737
* Update Android Studio Latest Version *
3838
* Update Gradle Latest Version *
3939
* Update Kotlin Latest Version *
40+
* Update Github Action Script *
41+
* Add Bash and Bat Script *
4042

4143
## Article Sources
4244
- [How To Securely Build and Sign Your Android App With GitHub Actions](https://proandroiddev.com/how-to-securely-build-and-sign-your-android-app-with-github-actions-ad5323452ce)
@@ -48,6 +50,147 @@ What's New??
4850
- [Upload Artifact From Github Action](https://github.com/actions/upload-artifact)
4951
- [Remove Artifact](https://github.com/c-hive/gha-remove-artifacts)
5052

53+
# Run Using Github Action and Push Commit Result
54+
55+
## How To Use Workflows
56+
57+
### Step 1. Upload Your Project on Github
58+
- Project must be android studio project using gradle
59+
60+
### Step 2. Create files github workflows
61+
- Create Files with name generate-apk-aab-debug-release.yml inside folder .github/workflows/
62+
- .github/workflows/generate-apk-aab-debug-release.yml this is position files
63+
64+
### Step 3. Create Code
65+
```yml
66+
name: Generated APK AAB (Push Github - Create Artifact To Github Action)
67+
68+
env:
69+
# The name of the main module repository
70+
main_project_module: app
71+
72+
# The name of the Play Store
73+
playstore_name: Frogobox ID
74+
75+
# The output folder for build results
76+
build_output_path: buildActionResult
77+
78+
on:
79+
80+
push:
81+
branches:
82+
- 'release/**'
83+
84+
# Allows you to run this workflow manually from the Actions tab
85+
workflow_dispatch:
86+
87+
jobs:
88+
build:
89+
90+
runs-on: ubuntu-latest
91+
92+
steps:
93+
- uses: actions/checkout@v4
94+
95+
# Set Current Date As Env Variable
96+
- name: Set current date as env variable
97+
run: echo "date_today=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
98+
99+
# Set Repository Name As Env Variable
100+
- name: Set repository name as env variable
101+
run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
102+
103+
- name: Set Up JDK
104+
uses: actions/setup-java@v4
105+
with:
106+
distribution: 'zulu' # See 'Supported distributions' for available options
107+
java-version: '17'
108+
cache: 'gradle'
109+
110+
- name: Change wrapper permissions
111+
run: chmod +x ./gradlew
112+
113+
# Run Tests Build
114+
- name: Run gradle tests
115+
run: ./gradlew test
116+
117+
# Run Build Project
118+
- name: Build gradle project
119+
run: ./gradlew build
120+
121+
# Create APK Debug
122+
- name: Build apk debug project (APK) - ${{ env.main_project_module }} module
123+
run: ./gradlew assembleDebug
124+
125+
# Create APK Release
126+
- name: Build apk release project (APK) - ${{ env.main_project_module }} module
127+
run: ./gradlew assemble
128+
129+
# Create Bundle AAB Release
130+
# Noted for main module build [main_project_module]:bundleRelease
131+
- name: Build app bundle release (AAB) - ${{ env.main_project_module }} module
132+
run: ./gradlew ${{ env.main_project_module }}:bundleRelease
133+
134+
# Upload Artifact Build
135+
# Noted For Output [main_project_module]/build/outputs/apk/debug/
136+
- name: Upload APK Debug - ${{ env.repository_name }}
137+
uses: actions/upload-artifact@v4
138+
with:
139+
name: ${{ env.date_today }} - ${{ env.playstore_name }} - ${{ env.repository_name }} - APK(s) debug generated
140+
path: ${{ env.main_project_module }}/build/outputs/apk/debug/
141+
142+
# Noted For Output [main_project_module]/build/outputs/apk/release/
143+
- name: Upload APK Release - ${{ env.repository_name }}
144+
uses: actions/upload-artifact@v4
145+
with:
146+
name: ${{ env.date_today }} - ${{ env.playstore_name }} - ${{ env.repository_name }} - APK(s) release generated
147+
path: ${{ env.main_project_module }}/build/outputs/apk/release/
148+
149+
# Noted For Output [main_project_module]/build/outputs/bundle/release/
150+
- name: Upload AAB (App Bundle) Release - ${{ env.repository_name }}
151+
uses: actions/upload-artifact@v4
152+
with:
153+
name: ${{ env.date_today }} - ${{ env.playstore_name }} - ${{ env.repository_name }} - App bundle(s) AAB release generated
154+
path: ${{ env.main_project_module }}/build/outputs/bundle/release/
155+
156+
# ======================================================
157+
# Copy Build Outputs & Push to GitHub
158+
# ======================================================
159+
160+
# Create build/outputs directory if it doesn't exist
161+
- name: Create build/outputs directory
162+
run: mkdir -p ${{ env.build_output_path }}
163+
164+
# Copy APK Debug to build/outputs
165+
- name: Copy APK Debug to build/outputs
166+
run: |
167+
cp -r ${{ env.main_project_module }}/build/outputs/apk/debug/* ${{ env.build_output_path }}/ 2>/dev/null || echo "No APK debug files found"
168+
169+
# Copy APK Release to build/outputs
170+
- name: Copy APK Release to build/outputs
171+
run: |
172+
cp -r ${{ env.main_project_module }}/build/outputs/apk/release/* ${{ env.build_output_path }}/ 2>/dev/null || echo "No APK release files found"
173+
174+
# Copy AAB Release to build/outputs
175+
- name: Copy AAB Release to build/outputs
176+
run: |
177+
cp -r ${{ env.main_project_module }}/build/outputs/bundle/release/* ${{ env.build_output_path }}/ 2>/dev/null || echo "No AAB release files found"
178+
179+
# List copied files for verification
180+
- name: List build/outputs contents
181+
run: ls -la ${{ env.build_output_path }}/
182+
183+
# Commit and Push to GitHub
184+
- name: Commit & Push build outputs to GitHub
185+
run: |
186+
git config user.name '${{ github.actor }}'
187+
git config user.email '${{ github.actor }}@users.noreply.github.com'
188+
git add ${{ env.build_output_path }}/ -f
189+
git diff --cached --quiet && echo "No changes to commit" || (git commit -m "ci: upload build outputs - ${{ env.date_today }} [skip ci]" && git push)
190+
```
191+
## Result Generated from Github Action (Private Repository Succesfully Build *Proven*)
192+
![ScreenShot](https://raw.githubusercontent.com/amirisback/automated-build-android-app-with-github-action/master/docs/image/ss-github-push.png?raw=true)
193+
51194
# Run Using Github Action
52195
53196
## How To Use Workflows
@@ -415,6 +558,75 @@ jobs:
415558
</component>
416559
```
417560

561+
# Run Using Script File
562+
563+
## Run Using Batch File
564+
```bat
565+
@echo off
566+
setlocal
567+
568+
:: Navigate to the project root directory
569+
cd /d "%~dp0.."
570+
571+
echo ======================================
572+
Starting Android Build Process
573+
echo ======================================
574+
575+
echo [1/6] Cleaning project...
576+
call gradlew clean
577+
578+
echo [2/6] Running tests...
579+
call gradlew test
580+
581+
echo [3/6] Building project...
582+
call gradlew build
583+
584+
echo [4/6] Assembling Debug APK...
585+
call gradlew assembleDebug
586+
587+
echo [5/6] Assembling Release APK...
588+
call gradlew assemble
589+
590+
echo [6/6] Building Release App Bundle (AAB)...
591+
call gradlew app:bundleRelease
592+
593+
echo ======================================
594+
Build completed successfully!
595+
echo ======================================
596+
pause
597+
```
598+
599+
## Run Using Shell Script
600+
```sh
601+
#!/bin/bash
602+
603+
echo "======================================"
604+
echo " Starting Android Build Process "
605+
echo "======================================"
606+
607+
echo "[1/6] Cleaning project..."
608+
./gradlew clean
609+
610+
echo "[2/6] Running tests..."
611+
./gradlew test
612+
613+
echo "[3/6] Building project..."
614+
./gradlew build
615+
616+
echo "[4/6] Assembling Debug APK..."
617+
./gradlew assembleDebug
618+
619+
echo "[5/6] Assembling Release APK..."
620+
./gradlew assemble
621+
622+
echo "[6/6] Building Release App Bundle (AAB)..."
623+
./gradlew app:bundleRelease
624+
625+
echo "======================================"
626+
echo " Build completed successfully! "
627+
echo "======================================"
628+
```
629+
418630
## Colaborator
419631
Very open to anyone, I'll write your name under this, please contribute by sending an email to me
420632

0 commit comments

Comments
 (0)