-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathaction.yaml
109 lines (97 loc) · 3.57 KB
/
action.yaml
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
name: flutter-android-build
description: '🏗 Easy to use flutter android build action'
author: NiklasLehnfeld
branding:
icon: 'zap'
color: 'black'
inputs:
release:
description: 'If set to `true`, it will run release builds, otherwise debug builds'
required: false
default: false
build-type:
description: 'apk | aab | both'
required: false
default: both
keystore:
description: 'Base64 encoded keystore.jks, required if release is true'
required: false
default: ''
keystore-pwd:
description: 'keystore password, required if release is true'
required: false
default: ''
key-pwd:
description: 'key password, required if release is true'
required: false
default: ''
outputs:
apk-path:
description: "Path to built apk if build-type was set to apk or both"
value: ${{ steps.path-output.outputs.apk-path }}
aab-path:
description: "Path to built aab if build-type was set to aab or both"
value: ${{ steps.path-output.outputs.aab-path }}
runs:
using: "composite"
steps:
- run: flutter pub get
shell: bash
- run: flutter pub run build_runner build --delete-conflicting-outputs
shell: bash
- run: echo "${{ inputs.keystore }}" | base64 -d > android/keystore.jks
shell: bash
- env:
KEY_PWD: ${{ inputs.key-pwd }}
KEYSTORE_PWD: ${{ inputs.keystore-pwd }}
run: |
if [ ${{ inputs.release }} = "true" ]; then
if [ ${{ inputs.build-type }} = "apk" ] || [ ${{ inputs.build-type }} = "both" ]; then
flutter build apk || true
fi
if [ ${{ inputs.build-type }} = "aab" ] || [ ${{ inputs.build-type }} = "both" ]; then
flutter build appbundle || true
fi
else
if [ ${{ inputs.build-type }} = "apk" ] || [ ${{ inputs.build-type }} = "both" ]; then
flutter build apk --debug || true
fi
if [ ${{ inputs.build-type }} = "aab" ] || [ ${{ inputs.build-type }} = "both" ]; then
flutter build appbundle --debug || true
fi
fi
shell: bash
- run: |
if [ ${{ inputs.release }} = "true" ]; then
if [ ${{ inputs.build-type }} = "apk" ] || [ ${{ inputs.build-type }} = "both" ]; then
APK_PATH=build/app/outputs/apk/release/`ls build/app/outputs/apk/release | grep apk`
if [ ! -f $APK_PATH ]; then
exit 1
fi
echo "apk-path=$(echo $APK_PATH)" >> $GITHUB_OUTPUT
fi
if [ ${{ inputs.build-type }} = "aab" ] || [ ${{ inputs.build-type }} = "both" ]; then
AAB_PATH=build/app/outputs/bundle/release/`ls build/app/outputs/bundle/release | grep aab`
if [ ! -f $AAB_PATH ]; then
exit 1
fi
echo "aab-path=$(echo $AAB_PATH)" >> $GITHUB_OUTPUT
fi
else
if [ ${{ inputs.build-type }} = "apk" ] || [ ${{ inputs.build-type }} = "both" ]; then
APK_PATH=build/app/outputs/apk/debug/`ls build/app/outputs/apk/debug | grep apk`
if [ ! -f $APK_PATH ]; then
exit 1
fi
echo "apk-path=$(echo $APK_PATH)" >> $GITHUB_OUTPUT
fi
if [ ${{ inputs.build-type }} = "aab" ] || [ ${{ inputs.build-type }} = "both" ]; then
AAB_PATH=build/app/outputs/bundle/debug/`ls build/app/outputs/bundle/debug | grep aab`
if [ ! -f $AAB_PATH ]; then
exit 1
fi
echo "aab-path=$(echo $AAB_PATH)" >> $GITHUB_OUTPUT
fi
fi
shell: bash
id: path-output