-
Notifications
You must be signed in to change notification settings - Fork 57
177 lines (155 loc) · 5.35 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
name: CD
on:
push:
branches:
- release
workflow_dispatch:
jobs:
build-android:
name: Release Android To AppCenter
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
# Replace with your Personal Access Tokens
with:
token: ${{ secrets.SHOUNAK_GITHUB_TOKEN }}
- uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '17'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
cache-key: "flutterCacheV1-:os:-:channel:-:version:-:arch:-:hash:"
pub-cache-key: "flutterPubCacheV1-:os:-:channel:-:version:-:arch:-:hash:"
- name: Setup .env.qa
env:
ENV_FILE: ${{ secrets.ENV_QA }}
run: echo -n $ENV_FILE | base64 --decode > .env.qa
- name: Setup .env.prod
env:
ENV_FILE: ${{ secrets.ENV_PROD }}
run: echo -n $ENV_FILE | base64 --decode > .env.prod
- name: Activate derry
run: flutter pub global activate derry
- name: Get Dependencies
run: flutter pub get
- name: Run build_runner
run: derry build_runner
- name: Bump Version
run: scripts/bump-build-number.sh
- name: Decode Keystore
id: decode_keystore
uses: timheuer/base64-to-file@v1
with:
fileName: 'flutter_template_keystore.jks'
encodedString: ${{ secrets.KEYSTORE }}
- name: Set Flavor Name
run: scripts/set-flavor-and-apk-path-to-env.sh
- name: Build APK
run: derry build release-apk $FLAVOR_NAME
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: wednesday-solutions/ANDROID-Flutter-Template
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
- name: Create Release and Add APK Artifact
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.tag_name }}
files: |
${{ env.APK_PATH }}
debug-info/app.android-arm.symbols
debug-info/app.android-arm64.symbols
debug-info/app.android-x64.symbols
build-ios:
name: Release iOS to TestFlight
runs-on: macos-latest
steps:
- name: iOS build disabled
run: echo Uncomment "build-ios" job to build and deploy ios app.
# - uses: actions/checkout@v3
# with:
# token: ${{ secrets.SHOUNAK_GITHUB_TOKEN }}
#
# - uses: subosito/flutter-action@v2
# with:
# channel: 'stable'
# cache: true
#
# - name: Setup .env.qa
# env:
# ENV_FILE: ${{ secrets.ENV_QA }}
# run: echo -n $ENV_FILE | base64 --decode > .env.qa
#
# - name: Setup .env.prod
# env:
# ENV_FILE: ${{ secrets.ENV_PROD }}
# run: echo -n $ENV_FILE | base64 --decode > .env.prod
#
# - name: Activate derry
# run: flutter pub global activate derry
#
# - name: Get Dependencies
# run: flutter pub get
#
# - name: Run build_runner
# run: derry build_runner
#
# - uses: maxim-lobanov/setup-xcode@v1
# with:
# xcode-version: latest-stable
#
# - 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
# # TODO: Move to derry
# run: chmod u+x scripts/build.sh && scripts/build.sh ipa prod --release
#
# - 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 "[email protected]" --password $PASSWORD --type ios --verbose
commit-version-update:
name: Commit Version Change
runs-on: ubuntu-latest
needs: [ build-android, build-ios ]
steps:
- uses: actions/checkout@v3
# Replace with your Personal Access Token
with:
token: ${{ secrets.SHOUNAK_GITHUB_TOKEN }}
- name: Bump Version
run: scripts/bump-build-number.sh
- name: Configure Git
run: |
git config user.name "Github Actions CD"
git config user.email "<>"
- name: Commit Version Change
run: scripts/commit-version.sh