-
Notifications
You must be signed in to change notification settings - Fork 3
64 lines (52 loc) · 1.95 KB
/
app-build.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
name: Android Build and Release
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Extract repository name
id: repo-name
run: echo "REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2)" >> $GITHUB_ENV
- name: Extract version name
id: version_name
run: |
VERSION_NAME=$(grep -oP 'versionName\s*=\s*"\K[^"]+' ./app/build.gradle.kts)
echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Setup Android SDK
uses: android-actions/setup-android@v2
- name: Install Android Build Tools
run: sdkmanager "build-tools;29.0.3"
- name: Inject Secrets into config.properties
run: |
echo "api_id=${{ secrets.API_ID }}" > app/src/main/assets/config.properties
echo "api_hash=${{ secrets.API_HASH }}" >> app/src/main/assets/config.properties
- uses: gradle/gradle-build-action@v2
with:
gradle-version: 8.6
arguments: assembleRelease
- uses: r0adkll/sign-android-release@v1
id: sign_app
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- run: mv ${{ steps.sign_app.outputs.signedReleaseFile }} ${{ env.REPO_NAME }}-v${{ env.VERSION_NAME }}-${{ github.run_number }}.apk
- uses: ncipollo/release-action@v1
with:
artifacts: "*.apk"
token: ${{ github.token }}
generateReleaseNotes: true
tag: v${{ env.VERSION_NAME }}-${{ github.run_number }}
prerelease: true