Skip to content

Commit 8c343df

Browse files
committed
Create GitHub Actions workflow to build app
1 parent 9d77855 commit 8c343df

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

.github/workflows/build-app.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Build Application
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches: [ main ]
7+
paths:
8+
- '**/*.gradle.kts'
9+
- 'app/src/**'
10+
- '.github/workflows/build-app.yml'
11+
push:
12+
branches: [ main ]
13+
paths:
14+
- '**/*.gradle.kts'
15+
- 'app/src/**'
16+
- '.github/workflows/build-app.yml'
17+
18+
jobs:
19+
build-app:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Set up JDK 17 and Gradle cache
25+
uses: actions/setup-java@v4
26+
with:
27+
distribution: 'temurin'
28+
java-version: '17'
29+
cache: 'gradle'
30+
31+
- name: Make Gradle executable
32+
run: chmod +x gradlew
33+
34+
# Build App
35+
- name: Build Application with Gradle
36+
env:
37+
NEWS_API_KEY: ${{ secrets.NEWS_API_KEY }}
38+
run: ./gradlew build
39+
40+
# Build Debug APK
41+
- name: Build debug apk
42+
env:
43+
NEWS_API_KEY: ${{ secrets.NEWS_API_KEY }}
44+
run: ./gradlew assembleDebug
45+
46+
# Build Release APK
47+
- name: Build release apk
48+
env:
49+
NEWS_API_KEY: ${{ secrets.NEWS_API_KEY }}
50+
run: ./gradlew assemble
51+
52+
# Build Bundle AAB Release
53+
- name: Build release aab
54+
env:
55+
NEWS_API_KEY: ${{ secrets.NEWS_API_KEY }}
56+
run: ./gradlew app:bundleRelease
57+
58+
- name: Upload the app-debug.apk artifact
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: app-debug
62+
path: app/build/outputs/apk/debug/app-debug.apk
63+
64+
- name: Upload the app-release.apk artifact
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: app-release
68+
path: app/build/outputs/apk/release/app-release-unsigned.apk
69+
70+
- name: Upload the app-release.aab artifact
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: aab-release
74+
path: app/build/outputs/bundle/release/app-release.aab
75+
76+
- name: Upload the Room Database Schema
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: room-database-schema
80+
path: app/schemas/**/*.json

0 commit comments

Comments
 (0)