-
Notifications
You must be signed in to change notification settings - Fork 15
99 lines (84 loc) · 3.15 KB
/
android.yaml
File metadata and controls
99 lines (84 loc) · 3.15 KB
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
name: Android CI
on:
push:
branches:
- main # Trigger on push to main branch
paths:
- '**/src/main/**'
- '**/build.gradle.kts'
- 'gradle/libs.versions.toml'
pull_request:
branches:
- main # Trigger on pull request targeting main branch
paths:
- '**/src/main/**'
- '**/build.gradle.kts'
- 'gradle/libs.versions.toml'
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout code
- name: Checkout code
uses: actions/checkout@v4
# Set up JDK
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
- name: Setup Gradle wrapper
run: chmod +x ./gradlew
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Setup Signing Config
run: |
echo ${{ secrets.SIGNING_KEYSTORE_BASE64 }} | base64 -d > doconfig/keystore.jks
echo packageName=com.madness.collision > doconfig/custom.properties
echo signingKeyStorePath=doconfig/keystore.jks >> doconfig/custom.properties
echo signingKeyStorePassword=${{ secrets.SIGNING_KEYSTORE_PASSWORD }} >> doconfig/custom.properties
echo signingKeyAlias=${{ secrets.SIGNING_KEY_ALIAS }} >> doconfig/custom.properties
echo signingKeyPassword=${{ secrets.SIGNING_KEY_PASSWORD }} >> doconfig/custom.properties
# Cache BundleTool to speed up builds
- name: Cache BundleTool
id: bundletool-cache
uses: actions/cache@v4
with:
path: doconfig/bundletool.jar
key: ${{ runner.os }}-bundletool-v1.18.2
- name: Setup BundleTool
if: steps.bundletool-cache.outputs.cache-hit != 'true'
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: 'google/bundletool'
version: 'tags/1.18.2'
file: 'bundletool-all-1.18.2.jar'
target: 'doconfig/bundletool.jar'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get commit hash and count
run: |
COMMIT_HASH=$(git rev-parse --short HEAD)
COMMIT_COUNT=$(git rev-list --count HEAD)
echo "COMMIT_HASH=${COMMIT_HASH}" >> $GITHUB_ENV
echo "COMMIT_COUNT=${COMMIT_COUNT}" >> $GITHUB_ENV
# Install dependencies
- name: Install dependencies
run: ./gradlew dependencies
# Build the app
- name: Build the FOSS app
run: ./gradlew :app:genFossApks -Pver.inc=true
# Build the app
- name: Build the app
run: ./gradlew :app:genUniversalApks -Pver.inc=true
# If you want to upload the APK as an artifact
- name: Upload FOSS APK as an artifact
uses: actions/upload-artifact@v4
with:
name: app-foss-apks-g${{ env.COMMIT_COUNT }}-${{ env.COMMIT_HASH }}
path: app/build/outputs/apks/foss/universal.apk
# If you want to upload the APK as an artifact
- name: Upload APK as an artifact
uses: actions/upload-artifact@v4
with:
name: app-release-apks-g${{ env.COMMIT_COUNT }}-${{ env.COMMIT_HASH }}
path: app/build/outputs/apks/release/universal.apk