-
Notifications
You must be signed in to change notification settings - Fork 16
186 lines (155 loc) · 5.61 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
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
184
185
186
name: CD
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-android:
name: Release Android To AppCenter
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
Directory: [ app ]
steps:
- uses: actions/checkout@v2
# Replace with your Personal Access Tokens
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: 'Install Tools'
run: |
./.github/workflows/scripts/install-tools.sh
- name: 'Bootstrap Workspace'
run: melos bootstrap
- name: Setup app_secrets.dart
env:
APP_SECRETS: ${{ secrets.APP_SECRETS }}
APP_SECRETS_PATH: app/lib/secrets/app_secrets.dart
run: echo -n $APP_SECRETS | base64 --decode > $APP_SECRETS_PATH
- name: Get Dependencies
run: melos run get
- name: Run build_runner
run: melos run generate
- name: Bump Build Number
run: scripts/bump-build-number.sh
working-directory: app/
- name: Decode Keystore
id: decode_keystore
uses: timheuer/base64-to-file@v1.1
with:
fileName: 'app_key.jks'
encodedString: ${{ secrets.KEYSTORE }}
- name: Set Flavor Name
run: scripts/set-flavor-and-apk-path-to-env.sh
working-directory: app/
- name: Build APK
run: scripts/build.sh apk $FLAVOR_NAME --release --obfuscate --split-debug-info=debug-info
working-directory: app/
env:
KEY_STORE_PATH: ${{ steps.decode_keystore.outputs.filePath }}
RELEASE_STORE_PASSWORD: ${{ secrets.RELEASE_STORE_PASSWORD }}
RELEASE_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }}
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
# - name: Upload Artifact to App Center
# uses: wzieba/AppCenter-Github-Action@v1
# with:
# appName: ANDROID-MyApp
# token: ${{ secrets.APP_CENTER_TOKEN }}
# group: Testers
# file: ${{ env.APK_PATH }}
# notifyTesters: true
- name: Add Tag Name to ENV
run: scripts/gh-action-read-and-set-version-env.sh
working-directory: app/
- name: Create Release and Add APK Artifact
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.tag_name }}
files: |
${{ env.APK_PATH }}
app/debug-info/app.android-arm.symbols
app/debug-info/app.android-arm64.symbols
app/debug-info/app.android-x64.symbols
build-ios:
name: Release iOS to TestFlight
runs-on: macos-latest
strategy:
matrix:
Directory: [ app ]
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: 'Install Tools'
run: |
./.github/workflows/scripts/install-tools.sh
- name: 'Bootstrap Workspace'
run: melos bootstrap
- name: Setup app_secrets.dart
env:
APP_SECRETS: ${{ secrets.APP_SECRETS }}
APP_SECRETS_PATH: app/lib/secrets/app_secrets.dart
run: echo -n $APP_SECRETS | base64 --decode > $APP_SECRETS_PATH
- name: Get Dependencies
run: melos run get
- name: Run build_runner
run: melos run generate
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Bump Build Number
run: scripts/bump-build-number.sh
working-directory: app/
# - name: Install the Apple certificate and provisioning profile
# env:
# BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
# P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
# BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
# KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
# run: chmod u+x scripts/install_certs.sh && scripts/install_certs.sh
- name: Retrieve Export-Options.plist from secrets
env:
PLIST: ${{ secrets.IOS_PLIST }}
PLIST_PATH: ${{ runner.temp }}/options.plist
run: echo -n "$PLIST" | base64 --decode --output $PLIST_PATH
# - name: Build the signed ipa
# run: chmod u+x scripts/build.sh && scripts/build.sh ipa prod --release
# working-directory: app/
# - name: Upload the signed ipa to TestFlight
# env:
# PASSWORD: ${{ secrets.APPSTORE_PASSWORD }}
# IPA_PATH: build/ios/ipa/prod.ipa
# run: xcrun altool --upload-app --file $IPA_PATH --username "ios@neosofttech.com" --password $PASSWORD --type ios --verbose
commit-version-update:
name: Commit Version Change
runs-on: ubuntu-latest
needs: [ build-android, build-ios ]
if: |
always() &&
(needs.build-android.result == 'success' || needs.build-ios.result == 'success')
steps:
- uses: actions/checkout@v2
# Replace with your Personal Access Token
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Bump Version
run: scripts/bump-build-number.sh
working-directory: app/
- name: Configure Git
run: |
git config user.name "Github Actions CD"
git config user.email "<>"
- name: Commit Version Change
run: scripts/commit-version.sh
working-directory: app/