-
Notifications
You must be signed in to change notification settings - Fork 1
120 lines (101 loc) · 3.52 KB
/
master-workflow.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
name: Flutter CI
on:
push:
branches:
- master
jobs:
test:
# This job will run on ubuntu virtual machine
runs-on: ubuntu-latest
steps:
# Setup Java environment in order to build the Android app.
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'
# Setup the flutter environment.
- uses: subosito/flutter-action@v1
with:
channel: 'stable' # 'dev', 'alpha', default to: 'stable'
# flutter-version: '1.12.x' # you can also specify exact version of flutter
# Get flutter dependencies.
- run: flutter pub get
# Check for any formatting issues in the code.
- run: dart format --set-exit-if-changed .
# Generate mocks
- run: dart pub run build_runner build
# Statically analyze the Dart code for any errors.
- run: flutter analyze .
# Run widget tests for our flutter project.
- run: flutter test
build_android:
runs-on: ubuntu-latest
steps:
# Setup Java environment in order to build the Android app.
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'
# Setup the flutter environment.
- uses: subosito/flutter-action@v1
with:
channel: 'stable' # 'dev', 'alpha', default to: 'stable'
# flutter-version: '1.12.x' # you can also specify exact version of flutter
# Get flutter dependencies.
- run: flutter pub get
# Generate the keystore file
- name: Decode keystore file
env:
CERTIFICATE_BASE64: ${{ secrets.STORE_FILE_CONTENT }}
run: echo $CERTIFICATE_BASE64 | base64 --decode > android/app/my-keystore.jks
- name: Create temporary key.properties
run: |
echo "storeFile=my-keystore.jks" > android/key.properties
echo "storePassword=${{ secrets.STORE_PASSWORD }}" >> android/key.properties
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties
# Generate the .env file
- name: Generate .env file
env:
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }}
run: echo "spotify_client_id=SPOTIFY_CLIENT_ID" > .env
# Build Android release
- run: flutter build appbundle --release
- uses: actions/upload-artifact@v2
with:
name: android-release
path: build/app/outputs/bundle/release/app-release.aab
build_ios:
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
with:
channel: 'stable'
- run: flutter pub get
- run: flutter build ios --release --no-codesign
- name: Upload iPA
uses: actions/upload-artifact@v2
with:
name: ios-release
path: build/ios/iphoneos
release:
needs: [test, build_android, build_ios]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
with:
name: ios-release
- uses: actions/download-artifact@v2
with:
name: android-release
- uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{secrets.SERVICE_ACCOUNT_JSON}}
packageName: com.example.flutter_app
releaseFiles: app-release.aab
track: internal
# TODO upload to app store