-
Notifications
You must be signed in to change notification settings - Fork 1
141 lines (132 loc) · 4.75 KB
/
build_test_publish.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Build and Upload to UBDiag
inputs:
projectKey:
required: true
app:
required: true
flavor:
required: true
appModule:
required: false
default: 'app'
self_hosted_cache_endpoint:
required: false
default: 'truenas.local.lan'
description: Should be set for selfhosted builds, but build won't fail without it
self_hosted_cache_port:
required: false
default: '9000'
self_hosted_cache_bucket:
required: false
default: github-actions-cache
self_hosted_cache_region:
required: false
default: local
do_store_upload:
required: false
default: no
ANDROID_JENKINS_PAT:
required: true
UB_ARTIFACTORY_URL_ANDROID:
required: true
UB_ARTIFACTORY_USERNAME:
required: true
UB_ARTIFACTORY_PASSWORD:
required: true
UBIQUE_POEDITOR_API_KEY:
required: true
ADDITIONAL_GRADLE_PROPS:
required: false
SENTRY_AUTH_TOKEN:
required: false
UPLOAD_KEY_STORE_PASSWORD:
required: true
UPLOAD_KEY_PASSWORD:
required: true
ANDROID_PUBLISHER_CREDENTIALS:
required: true
runs:
using: "composite"
steps:
# Checkout repository and submodules
- name: Checkout
uses: actions/[email protected]
with:
token: ${{ inputs.ANDROID_JENKINS_PAT }}
submodules: 'recursive'
lfs: 'true'
# Set build variables for reuse in multiple steps
- name: Set Build Variables
id: vars
shell: bash
run: |
flavor=${{ inputs.flavor }}
echo ::set-output name=build_uuid::$(cat /proc/sys/kernel/random/uuid)
echo ::set-output name=web_icon::${{ github.workspace }}/${{ inputs.appModule }}/tmp_icon_large_for_backend.png
echo ::set-output name=flavor_capitalized::${flavor~}
# Setup the build environment with Java 17 and the Zulu OpenJDK
- name: Setup Java
uses: actions/[email protected]
with:
distribution: 'zulu'
java-version: '17'
- name: Cache Maven packages on self-hosted MinIO
if: ${{ inputs.do_store_upload == 'no' }}
uses: tespkg/actions-cache@adf4e5e57e916ad83e63cc047ce271ef0843a24c
with:
endpoint: ${{ inputs.self_hosted_cache_endpoint }}
port: ${{ inputs.self_hosted_cache_port }}
insecure: true
accessKey: ${{ inputs.self_hosted_cache_access_key }}
secretKey: ${{ inputs.self_hosted_cache_secret_key }}
bucket: ${{ inputs.self_hosted_cache_bucket }}
region: ${{ inputs.self_hosted_cache_region }}
use-fallback: true
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-${{ inputs.projectKey }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-${{ inputs.projectKey }}-gradle-
# Setup the build environment with Gradle
- name: Setup Gradle
uses: gradle/[email protected]
with:
cache-disabled: true
# Assemble app
- name: Assemble app
shell: bash
run: ./gradlew :${{ inputs.appModule }}:assemble${{ steps.vars.outputs.flavor_capitalized }}Release
-PubiqueMavenUrl=${{ inputs.UB_ARTIFACTORY_URL_ANDROID }}
-PubiqueMavenUser=${{ inputs.UB_ARTIFACTORY_USERNAME }}
-PubiqueMavenPass=${{ inputs.UB_ARTIFACTORY_PASSWORD }}
-PubiquePoEditorAPIKey=${{ inputs.UBIQUE_POEDITOR_API_KEY }}
-Pbranch=${{ github.ref_name }}
-Pbuildnumber=${{ github.run_number }}
-Pubappid=${{ steps.vars.outputs.build_uuid }}
-Pwebicon=${{ steps.vars.outputs.web_icon }}
${{ inputs.ADDITIONAL_GRADLE_PROPS }}
# Upload to UBDiag
- name: Upload build to UBDiag
uses: UbiqueInnovation/[email protected]
with:
buildNumber: ${{ github.run_number }}
projectKey: ${{ inputs.projectKey }}
flavor: ${{ inputs.flavor }}
app: ${{ inputs.app }}
appModuleDirectory: './${{ inputs.appModule }}'
buildUuid: ${{ steps.vars.outputs.build_uuid }}
webIconFile: tmp_icon_large_for_backend.png
backendEndpoint: ${{ inputs.UBDIAG_UPLOAD_URL }}
self_hosted_cache_access_key: ${{ inputs.self_hosted_cache_access_key }}
self_hosted_cache_secret_key: ${{ inputs.self_hosted_cache_secret_key }}
# Setup the build environment with Gradle
- name: Publish the app
if: ${{ inputs.do_store_upload == 'yes' }}
shell: bash
run: ./gradlew :${{ inputs.appModule }}:publish${{ steps.vars.outputs.flavor_capitalized }}ReleaseUploadBundle
env:
UPLOAD_KEY_STORE_PASSWORD: ${{ inputs.UPLOAD_KEY_STORE_PASSWORD }}
UPLOAD_KEY_PASSWORD: ${{ inputs.UPLOAD_KEY_PASSWORD }}
ANDROID_PUBLISHER_CREDENTIALS: ${{ inputs.ANDROID_PUBLISHER_CREDENTIALS }}
SENTRY_AUTH_TOKEN: ${{ inputs.SENTRY_AUTH_TOKEN }}