Skip to content

Commit a50460b

Browse files
committed
Add GitHub Actions workflow for Android APK build
1 parent a305198 commit a50460b

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Build Android APK
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v4
19+
with:
20+
java-version: '17'
21+
distribution: 'temurin'
22+
23+
- name: Setup Android SDK
24+
uses: android-actions/setup-android@v3
25+
26+
- name: Grant execute permission for gradlew
27+
run: |
28+
cd android-app
29+
chmod +x gradlew 2>/dev/null || echo "No gradlew yet"
30+
31+
- name: Setup Gradle Wrapper
32+
run: |
33+
cd android-app
34+
gradle wrapper --gradle-version 8.2
35+
36+
- name: Build Release APK
37+
run: |
38+
cd android-app
39+
./gradlew assembleRelease
40+
41+
- name: Sign APK
42+
uses: r0adkll/sign-android-release@v1
43+
id: sign_app
44+
with:
45+
releaseDirectory: android-app/app/build/outputs/apk/release
46+
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
47+
alias: ${{ secrets.ALIAS }}
48+
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
49+
keyPassword: ${{ secrets.KEY_PASSWORD }}
50+
env:
51+
BUILD_TOOLS_VERSION: "34.0.0"
52+
continue-on-error: true
53+
54+
- name: Upload APK
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: DeadNet-APK
58+
path: |
59+
android-app/app/build/outputs/apk/release/*.apk
60+
${{ steps.sign_app.outputs.signedReleaseFile }}
61+
62+
- name: Release
63+
uses: softprops/action-gh-release@v1
64+
if: startsWith(github.ref, 'refs/tags/')
65+
with:
66+
files: |
67+
android-app/app/build/outputs/apk/release/*.apk
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)