Skip to content

Commit cd8cb22

Browse files
committed
add: new ci
1 parent 087391c commit cd8cb22

File tree

3 files changed

+96
-1
lines changed

3 files changed

+96
-1
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Generated APK AAB (Upload - Create Artifact To Github Action)
2+
3+
env:
4+
# The name of the main module repository
5+
main_project_module: app
6+
7+
# The name of the Play Store
8+
playstore_name: Frogobox ID
9+
10+
# Apk / Aab Name
11+
artifact_name: github-action-automated(2.2.1)
12+
13+
on:
14+
15+
push:
16+
branches:
17+
- 'release/**'
18+
19+
# Allows you to run this workflow manually from the Actions tab
20+
workflow_dispatch:
21+
22+
jobs:
23+
build:
24+
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- uses: actions/checkout@v3
29+
30+
# Set Current Date As Env Variable
31+
- name: Set current date as env variable
32+
run: echo "date_today=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
33+
34+
# Set Repository Name As Env Variable
35+
- name: Set repository name as env variable
36+
run: echo "repository_name=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')" >> $GITHUB_ENV
37+
38+
- name: Set Up JDK
39+
uses: actions/setup-java@v3
40+
with:
41+
distribution: 'zulu' # See 'Supported distributions' for available options
42+
java-version: '17'
43+
cache: 'gradle'
44+
45+
- name: Change wrapper permissions
46+
run: chmod +x ./gradlew
47+
48+
# Run Tests Build
49+
- name: Run gradle tests
50+
run: ./gradlew test
51+
52+
# Run Build Project
53+
- name: Build gradle project
54+
run: ./gradlew build
55+
56+
# Create APK Debug
57+
- name: Build apk debug project (APK) - ${{ env.main_project_module }} module
58+
run: ./gradlew assembleDebug
59+
60+
# Create APK Release
61+
- name: Build apk release project (APK) - ${{ env.main_project_module }} module
62+
run: ./gradlew assemble
63+
64+
# Create Bundle AAB Release
65+
# Noted for main module build [main_project_module]:bundleRelease
66+
- name: Build app bundle release (AAB) - ${{ env.main_project_module }} module
67+
run: ./gradlew ${{ env.main_project_module }}:bundleRelease
68+
69+
- name: Build apk from bundle using bundletool
70+
run: bundletool build-apks --bundle=${{ env.main_project_module }}/build/outputs/bundle/debug/${{ env.artifact_name }}-debug.aab --output=${{ env.main_project_module }}/build/outputs/apk/debug/${{ env.artifact_name }}-debug.apks
71+
72+
- name: Build apk from bundle using bundletool
73+
run: bundletool build-apks --bundle=${{ env.main_project_module }}/build/outputs/bundle/release/${{ env.artifact_name }}-release.aab --output=${{ env.main_project_module }}/build/outputs/apk/release/${{ env.artifact_name }}-release.apks
74+
75+
# Upload Artifact Build
76+
# Noted For Output [main_project_module]/build/outputs/apk/debug/
77+
- name: Upload APK Debug - ${{ env.repository_name }}
78+
uses: actions/upload-artifact@v3
79+
with:
80+
name: ${{ env.date_today }} - ${{ env.playstore_name }} - ${{ env.repository_name }} - APK(s) debug generated
81+
path: ${{ env.main_project_module }}/build/outputs/apk/debug/
82+
83+
# Noted For Output [main_project_module]/build/outputs/apk/release/
84+
- name: Upload APK Release - ${{ env.repository_name }}
85+
uses: actions/upload-artifact@v3
86+
with:
87+
name: ${{ env.date_today }} - ${{ env.playstore_name }} - ${{ env.repository_name }} - APK(s) release generated
88+
path: ${{ env.main_project_module }}/build/outputs/apk/release/
89+
90+
# Noted For Output [main_project_module]/build/outputs/bundle/release/
91+
- name: Upload AAB (App Bundle) Release - ${{ env.repository_name }}
92+
uses: actions/upload-artifact@v3
93+
with:
94+
name: ${{ env.date_today }} - ${{ env.playstore_name }} - ${{ env.repository_name }} - App bundle(s) AAB release generated
95+
path: ${{ env.main_project_module }}/build/outputs/bundle/release/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,4 @@ Waiting for your contribute
212212
- Please enjoy and don't forget fork and give a star
213213
- Don't Forget Follow My Github Account
214214

215-
![ScreenShot](https://raw.githubusercontent.com/amirisback/automated-build-android-app-with-github-action/master/docs/image/mad_score.png?raw=true)
215+
![ScreenShot](https://raw.githubusercontent.com/amirisback/automated-build-android-app-with-github-action/master/docs/image/mad_score.png?raw=true)

bundletool.jar

27.7 MB
Binary file not shown.

0 commit comments

Comments
 (0)