-
Notifications
You must be signed in to change notification settings - Fork 38
73 lines (69 loc) · 2.35 KB
/
gradle-task.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
name: Gradle task
on:
workflow_call:
inputs:
module:
description: 'Module to run'
required: true
type: string
task:
description: 'Task to run'
required: true
type: string
task-name:
description: 'Task Name'
required: true
type: string
push-apk:
description: 'Push artifact'
required: false
type: boolean
default: false
jobs:
task:
name: ${{ inputs.task-name }}
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Cache Gradle and wrapper
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
- name: Run ${{ inputs.task }} with Gradle
run: ./gradlew :${{ inputs.module }}:${{ inputs.task }}
# Build Artifact Debug
- name: Assemble Debug ${{ inputs.module }} with Gradle
if: ${{ inputs.push-apk }}
run: ./gradlew :${{ inputs.module }}:assembleDebug
# Build Artifact Release
- name: Assemble Release ${{ inputs.module }} with Gradle
if: ${{ inputs.push-apk }}
run: ./gradlew :${{ inputs.module }}:assembleRelease
# Upload Artifact Build Debug
# Noted For Output [main_project_module]/build/outputs/apk/debug/
- name: Upload APK Debug - ${{ env.repository_name }}
if: ${{ inputs.push-apk }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.date_today }} - ${{ env.repository_name }} - APK(s) debug generated
path: ${{ inputs.module }}/build/outputs/apk/debug/
# Upload Artifact Build Release
# Noted For Output [main_project_module]/build/outputs/apk/release/
- name: Upload APK Release - ${{ env.repository_name }}
if: ${{ inputs.push-apk }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.date_today }} - ${{ env.repository_name }} - APK(s) release generated
path: ${{ inputs.module }}/build/outputs/apk/release/