-
Notifications
You must be signed in to change notification settings - Fork 1
186 lines (153 loc) · 5.14 KB
/
cd-staging.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
181
182
183
# Flutter CI CD - GitHub Continuous Integration / Continuous Deployment Action that is triggered when someone tries to merge to release,
# which runs all tests, analyzes the code and then signs and deploys for Android and iOS on respective VMs using GitHub Secrets.
#
# Author: NightmindOfficial
# Co-Author: n/a
name: Stage
on:
pull_request:
types: [opened, reopened]
branches: [staging]
workflow_dispatch:
env:
FLUTTER_CHANNEL: 'stable' # 'stable', 'beta', or 'master', default to: 'stable'
XCODE_VERSION: '15.0'
PATH_TO_AAB: 'build/app/outputs/bundle/release/app-release.aab'
ANDROID_PACKAGE_NAME: 'de.investitacademy.linum'
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
DOTENV_KEY: ${{ secrets.DOTENV_KEY }}
jobs:
build-project-artifact:
name: Build Project Artifact
runs-on: ubuntu-latest
timeout-minutes: 30
environment: Staging-Prep
steps:
- uses: geekyeggo/delete-artifact@v2
with:
name: linum-dir-artifact
failOnError: false
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Flutter SDK
uses: subosito/flutter-action@v2
with:
channel: ${{ env.FLUTTER_CHANNEL }}
- name: Set up node
uses: actions/setup-node@v4
with:
node-version: 16
- name: Install npm
run: npm install
- name: Run build file
run: npm run build
env:
DOTENV_KEY: ${{ secrets.DOTENV_KEY }}
- name: Prepare Firebase Option Configuration
run: |
curl -sL https://firebase.tools | bash
dart pub global activate flutterfire_cli
ls
flutterfire --version
flutterfire configure -o lib/firebase/firebase_options.g.dart \
-p linum-5d9f6 -y --platforms="android,ios" \
-i de.investitacademy.linum \
-a de.investitacademy.linum \
-w de.investitacademy.linum \
-m de.investitacademy.linum \
--windows-app-id de.investitacademy.linum
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: linum-dir-artifact
path: ./
code-analysis-and-testing:
name: Pre-CD Code Analysis and Testing
needs: build-project-artifact
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Download a single artifact
uses: actions/download-artifact@v3
with:
name: linum-dir-artifact
- name: Set up Flutter SDK
uses: subosito/flutter-action@v2
with:
channel: ${{ env.FLUTTER_CHANNEL }}
- name: Analyze Flutter Code
run: flutter analyze
- name: Flutter Test
run: flutter test
android:
name: Android Beta Deployment
needs: code-analysis-and-testing
runs-on: ubuntu-latest
environment: Staging
timeout-minutes: 30
steps:
- name: Download a single artifact
uses: actions/download-artifact@v3
with:
name: linum-dir-artifact
- name: Install ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Set up Java Version
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '17'
- name: Set up Flutter SDK
uses: subosito/flutter-action@v2
with:
channel: ${{ env.FLUTTER_CHANNEL }}
- name: Make script executable
run: chmod +x ./android/android_cd.sh
- name: Run Android CD script
env:
KEY_PROPERTIES: ${{ secrets.KEY_PROPERTIES }}
ANDROID_SECRET_JSON: ${{ secrets.ANDROID_SECRET_JSON }}
KEYSTORE_GPG: ${{ secrets.KEYSTORE_GPG }}
KEYSTORE_GPG_PASS: ${{ secrets.KEYSTORE_GPG_PASS }}
run: ./android/android_cd.sh $KEY_PROPERTIES $KEYSTORE_GPG $KEYSTORE_GPG_PASS
ios:
name: iOS Beta Deployment
needs: code-analysis-and-testing
runs-on: macos-latest
environment: Staging
timeout-minutes: 70
steps:
- name: Download a single artifact
uses: actions/download-artifact@v3
with:
name: linum-dir-artifact
- name: Install ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Set up Flutter SDK
uses: subosito/flutter-action@v2
with:
channel: ${{ env.FLUTTER_CHANNEL }}
- id: Auth
name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCLOUD_KEY }}
# Not sure if needed anymore
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
- name: Make script executable
run: chmod +x ./ios/ios_cd.sh
# End of uncertainty
- name: Run iOS CD script
env:
FASTLANE_CERTS_REPO_KEY: ${{ secrets.FASTLANE_CERTS_REPO_KEY }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
run: ./ios/ios_cd.sh