-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (61 loc) · 2.4 KB
/
build_and_deploy_apk.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Android CI
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'zulu'
cache: gradle
- name: Set environment variables
run: |
echo "REMEMBER_ME_KEY_PASSWORD=${{ secrets.REMEMBER_ME_KEY_PASSWORD }}" >> $GITHUB_ENV
echo "REMEMBER_ME_KEYSTORE_PASSWORD=${{ secrets.REMEMBER_ME_KEYSTORE_PASSWORD }}" >> $GITHUB_ENV
echo "REMEMBER_ME_KEYSTORE_ALIAS=${{ secrets.REMEMBER_ME_KEYSTORE_ALIAS }}" >> $GITHUB_ENV
- name: Set GPG_TTY environment variable
run: echo "export GPG_TTY=true" >> $GITHUB_ENV
- name: Decrypt Keystore File
env:
RELEASE_KEYSTORE_PHRASE: ${{ secrets.RELEASE_KEYSTORE_PHRASE }}
RELEASE_KEYSTORE_FILE: ${{ secrets.REMEMBER_RELEASE_KEYSTORE }}
run: |
mkdir keys
echo "$RELEASE_KEYSTORE_FILE" > keys/keystore.jks.asc
echo "$RELEASE_KEYSTORE_PHRASE" > keys/keystore_passphrase.txt
gpg -d --passphrase-file=keys/keystore_passphrase.txt --batch keys/keystore.jks.asc > keys/keystore.jks
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
env:
KEYPASSWORD: ${{ secrets.REMEMBER_ME_KEY_PASSWORD }}
STOREPASSWORD: ${{ secrets.REMEMBER_ME_KEY_STORE_PASSWORD }}
KEYALIAS: ${{ secrets.REMEMBER_ME_KEYSTORE_ALIAS }}
run: ./gradlew build
- name: Build AAB with Gradle
env:
KEYPASSWORD: ${{ secrets.REMEMBER_ME_KEY_PASSWORD }}
STOREPASSWORD: ${{ secrets.REMEMBER_ME_KEYSTORE_PASSWORD }}
KEYALIAS: ${{ secrets.REMEMBER_ME_KEYSTORE_ALIAS }}
run: ./gradlew bundleRelease
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build
path: |
app/build/outputs/apk/release/*.apk
app/build/outputs/bundle/release/*.aab