-
Notifications
You must be signed in to change notification settings - Fork 1
113 lines (110 loc) · 3.55 KB
/
build_android.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
110
111
112
113
on:
workflow_call:
inputs:
appDirectory:
required: true
type: string
buildApk:
required: false
default: true
type: boolean
buildBundle:
required: false
default: true
type: boolean
upload:
required: false
default: false
type: boolean
archiveArtifacts:
required: false
default: false
type: boolean
buildNumberOffset:
required: false
default: 0
type: number
lfs:
required: false
default: false
type: boolean
runner:
required: false
type: string
default: ubuntu-latest
flutterVersion:
required: false
type: string
secrets:
additionalBuildArguments:
required: false
keyStore:
required: true
keyStorePassword:
required: true
keyPassword:
required: true
keyAlias:
required: true
googleApiKey:
required: false
jobs:
build_android:
name: Build Android App
runs-on: ${{ inputs.runner }}
steps:
- uses: actions/checkout@v2
with:
lfs: ${{ inputs.lfs }}
- name: Checkout LFS objects
if: ${{ inputs.lfs }}
run: git lfs checkout
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ inputs.flutterVersion }}
- name: Set Build Number
shell: bash
run: |
buildNumber=$((${{ inputs.buildNumberOffset }} + $GITHUB_RUN_NUMBER))
echo BUILD_NUMBER=$buildNumber >> $GITHUB_ENV
- name: Setup Signing
env:
keyPropertiesPath: ${{ github.workspace }}/${{ inputs.appDirectory }}/android/key.properties
keystorePath: ${{ github.workspace }}/${{ inputs.appDirectory }}/android/key.jks
androidKeyStore: ${{ secrets.keyStore }}
keyStorePassword: ${{ secrets.keyStorePassword }}
keyPassword: ${{ secrets.keyPassword }}
keyAlias: ${{ secrets.keyAlias }}
run: |
echo "${{ env.androidKeyStore }}" | base64 --decode > ${{ env.keystorePath }}
echo storePassword="${{ env.keyStorePassword }}" >> ${{ env.keyPropertiesPath }}
echo keyPassword="${{ env.keyPassword }}" >> ${{ env.keyPropertiesPath }}
echo keyAlias="${{ env.keyAlias }}" >> ${{ env.keyPropertiesPath }}
echo storeFile="${{ env.keystorePath }}" >> ${{ env.keyPropertiesPath }}
- name: Build Apk
if: inputs.buildApk
working-directory: ${{ inputs.appDirectory }}
run: flutter build apk --build-number=${{ env.BUILD_NUMBER }} ${{ secrets.additionalBuildArguments}}
- name: Build Bundle
if: inputs.buildBundle
working-directory: ${{ inputs.appDirectory }}
run: flutter build appbundle --build-number=${{ env.BUILD_NUMBER }} ${{ secrets.additionalBuildArguments}}
- name: Archive Artifacts
if: inputs.archiveArtifacts
uses: actions/upload-artifact@v3
with:
name: Android Apps
retention-days: 5
path: |
**/release/**/*.apk
**/release/**/app-release.aab
- name: Upload to Google Play
if: inputs.upload == true && github.event_name != 'pull_request'
uses: maierj/[email protected]
env:
GOOGLE_UPLOAD_KEY: ${{ secrets.googleApiKey }}
with:
verbose: true
lane: uploadApp
subdirectory: ./${{ inputs.appDirectory }}/android
bundle-install-path: "vendor/bundle"