-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (74 loc) · 2.85 KB
/
gradle-task.yml
File metadata and controls
80 lines (74 loc) · 2.85 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
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@85e6279cec87321a52edac9c87bce653a07cf6c2
- name: Set up JDK 17
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
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@2f8e54208210a422b2efd51efaa6bd6d7ca8920f
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
- name: Create local.properties
run: |
touch local.properties
echo "sandbox.components.public_key=${{ secrets.COMPONENTS_SANDBOX_PUBLIC_KEY }}" >> local.properties
echo "sandbox.components.secret_key=${{ secrets.COMPONENTS_SANDBOX_SECRET_KEY }}" >> local.properties
- 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@ea165f8d65b6e75b540449e92b4886f43607fa02
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@ea165f8d65b6e75b540449e92b4886f43607fa02
with:
name: ${{ env.date_today }} - ${{ env.repository_name }} - APK(s) release generated
path: ${{ inputs.module }}/build/outputs/apk/release/