-
Notifications
You must be signed in to change notification settings - Fork 11
77 lines (61 loc) · 2.71 KB
/
cd.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
name: CD
on:
release:
types: [published]
env:
FASTLANE_SUPPLY_JSON_KEY: ${{ secrets.FASTLANE_SUPPLY_JSON_KEY }}
PROD_BASE_URL: ${{ secrets.PROD_BASE_URL }}
RELEASE_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE }}
RELEASE_KEYSTORE_PROPERTIES: ${{ secrets.RELEASE_KEYSTORE_PROPERTIES }}
RELEASE_TYPE: ${{ contains(github.event.release.tag_name, 'internal') && 'internal' || contains(github.event.release.tag_name, 'beta') && 'beta' || 'prod' }}
FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
jobs:
deploy:
# This job will run on ubuntu virtual machine
runs-on: ubuntu-latest
# This job will run if the release is based on main branch
if: github.event.release.target_commitish == 'main'
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 Ruby for Fastlane
- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7.2'
bundler-cache: true
# Setup the flutter environment.
- uses: subosito/flutter-action@v1
with:
channel: "stable"
# Get flutter dependencies.
- run: flutter pub get
# Generate Freezed models
- run: flutter pub run build_runner build --delete-conflicting-outputs
# Check for any formatting issues in the code.
- run: flutter format --set-exit-if-changed .
# Statically analyze the Dart code for any errors.
- run: flutter analyze .
# Provide Firebase config file
- run: echo $FIREBASE_CONFIG | base64 --decode > android/app/google-services.json
# Save supply json key for fastlane
- run: echo "${FASTLANE_SUPPLY_JSON_KEY}" | base64 --decode > android/supply_json_key.json
# Save release props for signing
- run: echo "${RELEASE_KEYSTORE_PROPERTIES}" | base64 --decode > android/key.properties
# Save release keystore for signing
- run: echo "${RELEASE_KEYSTORE}" | base64 --decode > android/app/upload-keystore.jks
# Build appbundle.
- name: 'Development Appbundle'
if: "contains(env.RELEASE_TYPE, 'internal')"
run: flutter build appbundle --flavor development -t lib/main_development.dart --dart-define=SENTRY_DSN=${SENTRY_DSN}
- name: 'Production Appbundle'
if: "!contains(env.RELEASE_TYPE, 'internal')"
run: flutter build appbundle --flavor production -t lib/main_production.dart --dart-define=SENTRY_DSN=${SENTRY_DSN} --dart-define=BASE_URL=${PROD_BASE_URL}
# Run fastlane internal
- uses: maierj/[email protected]
with:
lane: ${{ env.RELEASE_TYPE }}
subdirectory: android