Skip to content

Commit bc9796c

Browse files
committed
Adding github actions
1 parent 452a118 commit bc9796c

File tree

2 files changed

+134
-0
lines changed

2 files changed

+134
-0
lines changed

.github/workflows/build.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Test/Build Android
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 30
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Set up JDK 11
18+
uses: actions/setup-java@v1
19+
with:
20+
java-version: 11
21+
22+
- name: Cache gradle
23+
uses: actions/cache@v1
24+
with:
25+
path: ~/.gradle/caches
26+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
27+
restore-keys: |
28+
${{ runner.os }}-gradle-
29+
30+
- name: Test (gradle)
31+
run: ./gradlew test --no-daemon
32+
33+
- name: Android Test Report
34+
uses: asadmansr/[email protected]
35+
if: ${{ always() }} # IMPORTANT: run Android Test Report regardless
36+
37+
- name: Build APK (gradle)
38+
run: ./gradlew assembleDebug --no-daemon
39+
40+
- name: Upload APK
41+
uses: actions/upload-artifact@v2
42+
with:
43+
name: Debug APK
44+
path: app/build/outputs/apk/debug/app-debug.apk
45+
46+
- name: Upload Test Results
47+
uses: actions/upload-artifact@v2
48+
with:
49+
name: Build Reports
50+
path: app/build/reports
51+

.github/workflows/create-release.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Create Release Assets
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
15+
- name: Set up JDK 11
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 11
19+
20+
- name: Cache gradle
21+
uses: actions/cache@v1
22+
with:
23+
path: ~/.gradle/caches
24+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
25+
restore-keys: |
26+
${{ runner.os }}-gradle-
27+
28+
- name: Build AAB
29+
run: ./gradlew clean bundleRelease --stacktrace
30+
31+
- name: Sign AAB
32+
uses: r0adkll/sign-android-release@v1
33+
with:
34+
releaseDirectory: app/build/outputs/bundle/release
35+
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
36+
alias: ${{ secrets.KEY_ALIAS }}
37+
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
38+
keyPassword: ${{ secrets.KEY_PASSWORD }}
39+
40+
- name: Build APK
41+
run: ./gradlew assembleRelease --stacktrace --no-daemon
42+
43+
- name: Sign APK
44+
uses: r0adkll/sign-android-release@v1
45+
with:
46+
releaseDirectory: app/build/outputs/apk/release
47+
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
48+
alias: ${{ secrets.KEY_ALIAS }}
49+
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
50+
keyPassword: ${{ secrets.KEY_PASSWORD }}
51+
52+
- name: Create Release
53+
id: create_release
54+
uses: actions/create-release@v1
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
with:
58+
tag_name: ${{ github.ref }}
59+
release_name: Release ${{ github.ref }}
60+
draft: false
61+
prerelease: false
62+
63+
- name: Upload APK Asset
64+
id: upload-release-asset-apk
65+
uses: actions/upload-release-asset@v1
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
with:
69+
upload_url: ${{ steps.create_release.outputs.upload_url }}
70+
asset_path: app/build/outputs/apk/release/app-release-unsigned-signed.apk
71+
asset_name: app-release-${{ github.ref }}.apk
72+
asset_content_type: application/zip
73+
74+
- name: Upload AAB Asset
75+
id: upload-release-asset-aab
76+
uses: actions/upload-release-asset@v1
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
with:
80+
upload_url: ${{ steps.create_release.outputs.upload_url }}
81+
asset_path: app/build/outputs/bundle/release/app-release.aab
82+
asset_name: app-release-${{ github.ref }}.aab
83+
asset_content_type: application/zip

0 commit comments

Comments
 (0)