-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
70 lines (61 loc) · 2.37 KB
/
action.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
name: 'Apk Analyze'
description: 'Analyse an Android APK file and return summary and individual info values'
# Inputs required by the action
inputs:
file-path: # id of input
description: 'The filepath to the APK'
required: true
generate-summary: # id of input
description: When 'false', no Job Summary will be generated for the Job.
required: false
default: 'true'
# Outputs generated by the action
outputs:
apk-file-size:
description: "The file size of the APK"
value: ${{ steps.apk-analyze.outputs.apkFileSize }}
apk-download-size:
description: "The download size of the APK (Human readable)"
value: ${{ steps.apk-analyze.outputs.apkDownloadSize }}
apk-download-size-bytes:
description: "The download size of the APK in bytes"
value: ${{ steps.apk-analyze.outputs.apkDownloadSizeBytes }}
# Execution for the action
runs:
using: "composite" # Keyword used to identify this as a composite action
steps:
- name: Setup
shell: bash
run: |
ANDROID_CMD_TOOLS=${ANDROID_HOME}/cmdline-tools/latest/bin
echo "$ANDROID_CMD_TOOLS" >> $GITHUB_PATH
- name: Check
id: apk-analyze
shell: bash
run: |
filePath=${{ inputs.file-path }}
fileName=$(basename -- $filePath)
fileSize=$(apkanalyzer -h apk file-size $filePath)
downloadSize=$(apkanalyzer -h apk download-size $filePath)
downloadSizeBytes=$(apkanalyzer apk download-size $filePath)
{
echo "apkFileName=$fileName"
echo "apkFileSize=$fileSize"
echo "apkDownloadSize=$downloadSize"
echo "apkDownloadSizeBytes=$downloadSizeBytes"
} >> $GITHUB_OUTPUT
- name: Create Summary
id: apk-analyze-summary
if: ${{ success() && inputs.generate-summary != 'false'}}
shell: bash
run: |
{
echo "### Apk Analysis Results"
echo "| Description | Value |"
echo "| ----------- | ----- |"
echo "| File Name | ${{ steps.apk-analyze.outputs.apkFileName }} |"
echo "| File Size | ${{ steps.apk-analyze.outputs.apkFileSize }} |"
echo "| Download Size | ${{ steps.apk-analyze.outputs.apkDownloadSize }} |"
echo "| Download Size Bytes | ${{ steps.apk-analyze.outputs.apkDownloadSizeBytes }} |"
} >> $GITHUB_STEP_SUMMARY
echo "Summary complete"