Skip to content

Commit 5fae891

Browse files
feat: Implement Automated Android Build Pipeline
Implements a complete, two-stage GitHub Actions pipeline to automatically build an Android APK from the repository. - **Configuration Bot**: A workflow (`config-bot.yml`) runs on every push to ensure the repository has a valid Android project structure. It executes a script (`align_android_config.sh`) to generate any missing Gradle files, source files, or the official Gradle Wrapper, and auto-commits the changes. - **Build Bot**: A second workflow (`android-build.yml`) triggers after the configuration bot succeeds. It sets up a Java/Android environment, installs frontend dependencies for the web terminal (`npm install`), and builds a debug APK using Gradle. - **Self-Contained APK**: The resulting Android application packages the web terminal and embeds a `nodejs-mobile-android` runtime. This allows the terminal's `server.js` backend to run directly on the device, making the application fully self-contained and functional. The `server.js` and Android runtime logic have been aligned to work together correctly. - The final APK is uploaded as a downloadable artifact from the GitHub Actions run.
1 parent b11ed4a commit 5fae891

13 files changed

Lines changed: 1510 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build Android APK
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Align Android Config Bot"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
build:
11+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout Repository
16+
uses: actions/checkout@v4
17+
18+
- name: Set up JDK 17
19+
uses: actions/setup-java@v4
20+
with:
21+
java-version: '17'
22+
distribution: 'temurin'
23+
24+
- name: Install Frontend Dependencies
25+
run: |
26+
cd web-terminal
27+
npm install
28+
29+
- name: Validate Gradle wrapper
30+
uses: gradle/wrapper-validation-action@v2
31+
32+
- name: Setup Gradle
33+
uses: gradle/actions/setup-gradle@v3
34+
35+
- name: Make gradlew executable
36+
run: chmod +x ./gradlew
37+
38+
- name: Build with Gradle
39+
run: ./gradlew build
40+
41+
- name: Upload APK
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: debug-apk
45+
path: app/build/outputs/apk/debug/app-debug.apk

.github/workflows/config-bot.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Align Android Config Bot
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Or your primary branch
7+
8+
jobs:
9+
align:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Repository
13+
uses: actions/checkout@v4
14+
15+
- name: Run Alignment Script
16+
run: ./align_android_config.sh
17+
18+
- name: Download and Extract Gradle Wrapper JAR
19+
run: |
20+
mkdir -p gradle/wrapper
21+
curl -L -o gradle-dist.zip https://services.gradle.org/distributions/gradle-8.2-bin.zip
22+
unzip -p gradle-dist.zip gradle-8.2/lib/gradle-wrapper-8.2.jar > gradle/wrapper/gradle-wrapper.jar
23+
rm gradle-dist.zip
24+
25+
- name: Auto-commit changes
26+
uses: stefanzweifel/git-auto-commit-action@v5
27+
with:
28+
commit_message: "chore: Align Android configuration"
29+
branch: ${{ github.ref_name }}
30+
commit_options: '--no-verify'
31+
file_pattern: 'build.gradle settings.gradle app/build.gradle gradlew gradlew.bat gradle/wrapper/gradle-wrapper.properties src/**'
32+
repository: .
33+
commit_user_name: Config Bot
34+
commit_user_email: bot@superlab.com
35+
commit_author: Config Bot <bot@superlab.com>

0 commit comments

Comments
 (0)