-
Notifications
You must be signed in to change notification settings - Fork 1
113 lines (111 loc) · 3.68 KB
/
build_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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Minimal Android CI Workflow
on:
workflow_dispatch:
inputs:
tag_name:
description: 'Tag name for release'
required: false
default: prerelease
push:
branches:
- master
tags:
- 'v*'
jobs:
test:
name: Run Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup JDK
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.konan
key: ${{ runner.os }}-gradle-v3-${{ hashFiles('gradle.properties', 'gradle/libs.versions.toml', 'gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-v3-
- name: Run Tests
run: bash ./gradlew test --stacktrace
apk:
name: Generate APK
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup JDK
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.konan
key: ${{ runner.os }}-gradle-v3-${{ hashFiles('gradle.properties', 'gradle/libs.versions.toml', 'gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-v3-
- name: Decode Keystore
id: decode_keystore
uses: timheuer/[email protected]
with:
fileName: 'android_keystore.keystore'
fileDir: '/home/runner/work/Kex/Kex/app/keystore/'
encodedString: ${{ secrets.KEYSTORE }}
- name: Build APK
run: bash ./gradlew assembleRelease --stacktrace
env:
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
- name: Verify Signature
run: $ANDROID_SDK_ROOT/build-tools/33.0.1/apksigner verify --print-certs app/build/outputs/apk/release/app-release.apk
- name: Upload APK
uses: actions/upload-artifact@v1
with:
name: apk
path: app/build/outputs/apk/release/app-release.apk
release:
name: Publish
needs: apk
# if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Download APK from build
uses: actions/download-artifact@v1
with:
name: apk
- if: github.event_name == 'workflow_dispatch'
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
- if: github.event_name == 'push'
run: echo 'TAG_NAME=prerelease' >> $GITHUB_ENV
- if: env.TAG_NAME == 'prerelease'
run: |
(echo 'SUBJECT=Kex prerelease';
echo 'PRERELEASE=--prerelease') >> $GITHUB_ENV
gh release delete prerelease --yes || true
git push origin :prerelease || true
- name: Upload Debug APK
id: upload_debug_asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create $TAG_NAME $PRERELEASE --title "$TAG_NAME" --target $GITHUB_SHA apk/app-release.apk#Kex.apk