Skip to content

Commit b1e64f1

Browse files
committed
Create build.yml
1 parent 6337ebe commit b1e64f1

1 file changed

Lines changed: 78 additions & 0 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Build APK
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
tags: ['v*']
7+
pull_request:
8+
branches: [main, master]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
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 Gradle
24+
uses: gradle/actions/setup-gradle@v4
25+
26+
# ── Debug build (every push / PR) ──────────────────────────────
27+
28+
- name: Build debug APK
29+
run: ./gradlew assembleDebug --no-daemon
30+
31+
- name: Upload debug APK
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: app-debug
35+
path: app/build/outputs/apk/debug/app-debug.apk
36+
37+
# ── Release build (tags only, signed if secrets configured) ────
38+
39+
- name: Decode keystore
40+
if: startsWith(github.ref, 'refs/tags/v') && env.KEYSTORE_BASE64 != ''
41+
env:
42+
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
43+
run: echo "$KEYSTORE_BASE64" | base64 -d > release.keystore
44+
45+
- name: Create keystore.properties
46+
if: startsWith(github.ref, 'refs/tags/v') && env.KEYSTORE_BASE64 != ''
47+
env:
48+
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
49+
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
50+
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
51+
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
52+
run: |
53+
cat > keystore.properties <<EOF
54+
storeFile=release.keystore
55+
storePassword=$KEYSTORE_PASSWORD
56+
keyAlias=$KEY_ALIAS
57+
keyPassword=$KEY_PASSWORD
58+
EOF
59+
60+
- name: Build release APK
61+
if: startsWith(github.ref, 'refs/tags/v')
62+
run: ./gradlew assembleRelease --no-daemon
63+
64+
- name: Upload release APK
65+
if: startsWith(github.ref, 'refs/tags/v')
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: app-release-unsigned
69+
path: app/build/outputs/apk/release/app-release-unsigned.apk
70+
71+
- name: Upload signed release APK
72+
if: startsWith(github.ref, 'refs/tags/v') && env.KEYSTORE_BASE64 != ''
73+
env:
74+
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: app-release-signed
78+
path: app/build/outputs/apk/release/app-release.apk

0 commit comments

Comments
 (0)