-
Notifications
You must be signed in to change notification settings - Fork 1
102 lines (90 loc) · 3.33 KB
/
preview-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
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
name: Build Android APK
run-name: Build Job
on:
workflow_dispatch:
inputs:
repository:
description: "Git repository URL"
required: true
default: "https://github.com/abdallahmehiz/mpvKt"
appName:
description: "New app name"
required: false
applicationId:
description: "New application ID"
required: false
jdkVersion:
description: "OpenJDK version to use: 8 / 11 / 17 etc."
required: false
default: "17"
taskName:
description: "build.gradle task name: assemble[Type]"
required: false
default: "assembleRelease"
jobs:
build:
runs-on: ubuntu-latest # Android SDK is built-in in this image
steps:
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: ${{ github.event.inputs.jdkVersion }}
- name: Clone project
run: git clone ${{ github.event.inputs.repository }} workspace
- name: Change App Name
run: |
set -e
cd workspace
if [ -n "${{ github.event.inputs.appName }}" ]; then
sed -i 's|<string name="app_name">.*</string>|<string name="app_name">${{ github.event.inputs.appName }}</string>|' app/src/main/res/values/strings.xml
fi
- name: Change Application ID
run: |
set -e
cd workspace
if [ -n "${{ github.event.inputs.applicationId }}" ]; then
sed -i 's|applicationId = ".*"|applicationId = "${{ github.event.inputs.applicationId }}"|' app/build.gradle.kts
fi
- name: Build APK
working-directory: ./workspace
run: |
if [ ! -f "gradlew" ]; then gradle wrapper; fi
chmod +x gradlew
./gradlew ${{ github.event.inputs.taskName }} --stacktrace
- name: Count commits
run: |
set -e
cd workspace
commit_count=$(git rev-list --count HEAD)
echo "COMMIT_COUNT=$commit_count" >> $GITHUB_ENV
- name: Upload APK 1
uses: actions/upload-artifact@v4
with:
path: ./workspace/app/build/outputs/apk/release/app-universal-release-unsigned.apk
name: app-standard-universal-${{ env.COMMIT_COUNT }}.apk
retention-days: 3
- name: Upload APK 2
uses: actions/upload-artifact@v4
with:
path: ./workspace/app/build/outputs/apk/release/app-arm64-v8a-release-unsigned.apk
name: app-standard-arm64-v8a-r${{ env.COMMIT_COUNT }}.apk
retention-days: 3
- name: Upload APK 3
uses: actions/upload-artifact@v4
with:
path: ./workspace/app/build/outputs/apk/release/app-armeabi-v7a-release-unsigned.apk
name: app-standard-armeabi-v7a-r${{ env.COMMIT_COUNT }}.apk
retention-days: 3
- name: Upload APK 4
uses: actions/upload-artifact@v4
with:
path: ./workspace/app/build/outputs/apk/release/app-x86-release-unsigned.apk
name: app-standard-x86-r${{ env.COMMIT_COUNT }}.apk
retention-days: 3
- name: Upload APK 5
uses: actions/upload-artifact@v4
with:
path: ./workspace/app/build/outputs/apk/release/app-x86_64-release-unsigned.apk
name: app-standard-x86_64-r${{ env.COMMIT_COUNT }}.apk
retention-days: 3