This repository has been archived by the owner on Feb 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
53 lines (47 loc) · 1.71 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
name: 'Universal APK Generate Action'
description: 'Generate Universal APK file from Android App Bundle file.'
inputs:
aab-path:
description: ''
required: true
keystore-base64:
description: ''
required: true
keystore-password:
description: ''
required: true
key-alias:
description: ''
required: true
key-password:
description: ''
required: true
outputs:
apk-path:
description: ''
value: ${{ steps.generate.outputs.apk-path }}
runs:
using: 'composite'
steps:
#- run: echo '${{ toJson(github) }}'
# shell: bash
- name: Generate Universal APK file
id: generate
shell: bash
env:
AAB_PATH: ${{ inputs.aab-path }}
KEYSTORE_BASE64: ${{ inputs.keystore-base64 }}
KEYSTORE_PASSWORD: ${{ inputs.keystore-password }}
KEY_ALIAS: ${{ inputs.key-alias }}
KEY_PASSWORD: ${{ inputs.key-password }}
run: |
aab_file=${AAB_PATH##*/}
aab_name=${aab_file%.*}
mkdir $HOME/work/universal-apk-generate-action
work_dir=$HOME/work/universal-apk-generate-action
curl -f -L -o $work_dir/bundletool.jar https://github.com/google/bundletool/releases/download/1.4.0/bundletool-all-1.4.0.jar
echo $KEYSTORE_BASE64 | base64 -d > $work_dir/keystore.jks
java -jar "$work_dir/bundletool.jar" build-apks --bundle=$AAB_PATH --output=$work_dir/app.apks --ks=$work_dir/keystore.jks --ks-pass=pass:$KEYSTORE_PASSWORD --ks-key-alias=$KEY_ALIAS --key-pass=pass:$KEY_PASSWORD --mode=universal
unzip $work_dir/app.apks -d $work_dir
mv $work_dir/universal.apk $work_dir/${aab_name}-universal.apk
echo "::set-output name=apk-path::$work_dir/${aab_name}-universal.apk"