forked from authgear/authgear-sdk-flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
180 lines (169 loc) · 6 KB
/
ci.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: CI
on:
push:
branches:
- '*'
- '!gh-pages'
pull_request:
branches:
- '*'
- '!gh-pages'
jobs:
test-ios:
runs-on: macos-13
if: ${{ github.event_name == 'pull_request' }}
defaults:
run:
working-directory: "./example"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer
- uses: subosito/flutter-action@v2
with:
# Use the latest stable release
flutter-version: '3.x'
channel: 'stable'
- run: flutter pub get
- run: flutter test
- run: flutter analyze --no-fatal-infos
- run: dart format --set-exit-if-changed lib
- run: flutter build ios
test-android:
runs-on: macos-12
if: ${{ github.event_name == 'pull_request' }}
defaults:
run:
working-directory: "./example"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install -g appcenter-cli
- uses: subosito/flutter-action@v2
with:
# Use the latest stable release
flutter-version: '3.x'
channel: 'stable'
- run: flutter pub get
- run: flutter test
- run: flutter analyze --no-fatal-infos
- run: dart format --set-exit-if-changed lib
- run: flutter build apk
deploy:
runs-on: ubuntu-22.04
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
# Use the latest stable release
flutter-version: '3.x'
channel: 'stable'
- run: flutter pub get
- run: flutter test
- run: flutter analyze --no-fatal-infos
- run: dart format --set-exit-if-changed lib
# Install the latest dartdoc to avoid a bug
# See DEVELOPER.md
- run: flutter pub global activate dartdoc
if: ${{ github.ref == 'refs/heads/main' }}
- run: flutter pub global run dartdoc
if: ${{ github.ref == 'refs/heads/main' }}
- name: Deploy docs to gh-pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc/api
deploy-ios:
runs-on: macos-13
needs: "deploy"
if: ${{ github.ref == 'refs/heads/main' }}
defaults:
run:
working-directory: "./example"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer
- run: npm install -g appcenter-cli
- uses: subosito/flutter-action@v2
with:
# Use the latest stable release
flutter-version: '3.x'
channel: 'stable'
- run: flutter pub get
- run: flutter test
- run: flutter analyze --no-fatal-infos
- run: dart format --set-exit-if-changed lib
- name: Prepare certificate and provisioning profile
env:
IOS_CERTIFICATE_BASE64: ${{ secrets.IOS_CERTIFICATE_BASE64 }}
IOS_PROVISIONING_PROFILE_BASE64: ${{ secrets.IOS_PROVISIONING_PROFILE_BASE64 }}
run: |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
echo -n "$IOS_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
echo -n "$IOS_PROVISIONING_PROFILE_BASE64" | base64 --decode --output $PP_PATH
security create-keychain -p "" $KEYCHAIN_PATH
security set-keychain-settings $KEYCHAIN_PATH
security unlock-keychain -p "" $KEYCHAIN_PATH
security import $CERTIFICATE_PATH -P "" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Build .ipa
run: |
BUILD_NUMBER=$(date +%s)
flutter build ipa --export-options-plist ./exportOptions.plist --build-number $BUILD_NUMBER
- name: Distribute to App Center
env:
APPCENTER_ACCESS_TOKEN: ${{ secrets.IOS_APPCENTER_ACCESS_TOKEN }}
run: appcenter distribute release --debug --silent --file "./build/ios/ipa/Authgear Flutter.ipa" --store "App Store Connect Users" --app "Oursky/Authgear-Demo-Flutter-iOS" --release-notes "no release notes"
deploy-android:
runs-on: macos-12
needs: "deploy"
if: ${{ github.ref == 'refs/heads/main' }}
defaults:
run:
working-directory: "./example"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install -g appcenter-cli
- uses: subosito/flutter-action@v2
with:
# Use the latest stable release
flutter-version: '3.x'
channel: 'stable'
- run: flutter pub get
- run: flutter test
- run: flutter analyze --no-fatal-infos
- run: dart format --set-exit-if-changed lib
- name: Prepare key store
env:
ANDROID_KEY_STORE_BASE64: ${{ secrets.ANDROID_KEY_STORE_BASE64 }}
run: |
KEY_STORE_PATH=./android/app/keystore.jks
echo -n "$ANDROID_KEY_STORE_BASE64" | base64 --decode --output "$KEY_STORE_PATH"
- name: Build .apk
env:
STORE_PASSWORD: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
run: |
BUILD_NUMBER=$(date +%s)
flutter build apk --build-number $BUILD_NUMBER -P STORE_PASSWORD="$STORE_PASSWORD" -P KEY_PASSWORD="$KEY_PASSWORD" -P KEY_ALIAS="$KEY_ALIAS"
- name: Distribute to App Center
env:
APPCENTER_ACCESS_TOKEN: ${{ secrets.ANDROID_APPCENTER_ACCESS_TOKEN }}
run: appcenter distribute release --debug --silent --file "./build/app/outputs/flutter-apk/app-release.apk" --group "Collaborators" --app "Oursky/Authgear-Demo-Flutter-Android"