-
-
Notifications
You must be signed in to change notification settings - Fork 2
236 lines (232 loc) · 9.45 KB
/
flutter.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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
name: Flutter
on:
push:
tags:
- '*'
branches:
- '*'
- '!l10n_master'
pull_request: {}
permissions:
contents: write
jobs:
android:
strategy:
matrix:
arch: [x64]
channel: [stable]
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
cache: true
channel: ${{ matrix.channel }}
architecture: ${{ matrix.arch }}
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
- run: flutter doctor
- name: Download dependencies
run: flutter pub get
- if: ${{ !github.event.issue.pull_request }}
name: Set up signing
env:
ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
ENCODED_STRING: ${{ secrets.ANDROID_KEYSTORE_FILE }}
run: |
echo "$ENCODED_STRING" | base64 -di >upload-keystore.jks
echo "storePassword=$ANDROID_STORE_PASSWORD" >android/key.properties
echo "keyPassword=$ANDROID_KEY_PASSWORD" >>android/key.properties
echo "keyAlias=upload" >>android/key.properties
echo "storeFile=$(readlink -e .)/upload-keystore.jks" >>android/key.properties
- name: Extract version
run: |
export VERSION=$(grep "version: " pubspec.yaml | cut -f2 -d ' ' | cut -f1 -d '+')
echo "VERSION=$VERSION" >>$GITHUB_ENV
- if: ${{ github.event.issue.pull_request }}
name: Set env vars for pull request
run: |
echo "RELEASE_FILE=build/app/outputs/bundle/profile/app-profile.aab" >> $GITHUB_ENV
echo "RELEASE_FILE_APK=build/app/outputs/flutter-apk/app-profile.apk" >> $GITHUB_ENV
echo "RELEASE_NAME=v$VERSION-${{ github.sha }}" >> $GITHUB_ENV
- if: ${{ !github.event.issue.pull_request && !startsWith(github.ref, 'refs/tags/') }}
name: Set env vars for staging
run: |
if [[ "${{ github.ref_name }}" == "master" ]]; then
echo "TRACK=beta" >> $GITHUB_ENV
else
echo "TRACK=internal" >> $GITHUB_ENV
fi
echo "RELEASE_FILE=build/app/outputs/bundle/release/app-release.aab" >> $GITHUB_ENV
echo "RELEASE_FILE_APK=build/app/outputs/flutter-apk/app-release.apk" >> $GITHUB_ENV
echo "RELEASE_NAME=v$VERSION-${{ github.sha }}" >> $GITHUB_ENV
- if: ${{ !github.event.issue.pull_request && startsWith(github.ref, 'refs/tags/') }}
name: Set env vars for release
run: |
echo "TRACK=production" >> $GITHUB_ENV
echo "RELEASE_FILE=build/app/outputs/bundle/release/app-release.aab" >> $GITHUB_ENV
echo "RELEASE_FILE_APK=build/app/outputs/flutter-apk/app-release.apk" >> $GITHUB_ENV
echo "RELEASE_NAME=v${{ github.ref_name }}" >> $GITHUB_ENV
- if: ${{ !github.event.issue.pull_request }}
name: Build for Android (release)
run: |
flutter build appbundle --release --build-number $GITHUB_RUN_NUMBER --dart-define=COMMIT_HASH=$GITHUB_SHA --dart-define=SENTRY_DSN=${{ secrets.SENTRY_DSN }}
flutter build apk --release --build-number $GITHUB_RUN_NUMBER --dart-define=COMMIT_HASH=$GITHUB_SHA --dart-define=SENTRY_DSN=${{ secrets.SENTRY_DSN }}
- if: ${{ github.event.issue.pull_request }}
name: Build for Android (profile)
run: |
flutter build appbundle --profile --build-number $GITHUB_RUN_NUMBER --dart-define=COMMIT_HASH=$GITHUB_SHA --dart-define=SENTRY_DSN=${{ secrets.SENTRY_DSN }}
flutter build apk --profile --build-number $GITHUB_RUN_NUMBER --dart-define=COMMIT_HASH=$GITHUB_SHA --dart-define=SENTRY_DSN=${{ secrets.SENTRY_DSN }}
- name: Upload Android APK
uses: actions/upload-artifact@v3
with:
name: com.expidusos.file_manager.apk
path: |
${{ env.RELEASE_FILE_APK }}
- if: ${{ !github.event.issue.pull_request }}
name: Deploy to Google Play
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.ANDROID_SERVICE_ACCOUNT }}
packageName: com.expidusos.file_manager
releaseFiles: ${{ env.RELEASE_FILE }}
track: ${{ env.TRACK }}
releaseName: ${{ env.RELEASE_NAME }}
- if: startsWith(github.ref, 'refs/tags/')
name: Rename files for release
run: |
mv ${{ env.RELEASE_FILE }} com.expidusos.file_manager.aab
mv ${{ env.RELEASE_FILE_APK }} com.expidusos.file_manager.apk
- if: startsWith(github.ref, 'refs/tags/')
name: Release
uses: meeDamian/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: com.expidusos.file_manager.apk
allow_override: true
gzip: false
linux:
strategy:
matrix:
arch: [x64]
channel: [master]
continue-on-error: true
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:freedesktop-22.08
options: --privileged
steps:
- uses: actions/checkout@v3
- name: Add dependencies
run: |
dnf update -y
dnf install -y jq cmake ninja-build gtk3-devel clang
dnf clean all
- uses: subosito/flutter-action@v2
with:
cache: true
channel: ${{ matrix.channel }}
architecture: ${{ matrix.arch }}
- if: ${{ !github.event.issue.pull_request }}
name: Set up GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.FLATPAK_GPG_KEY }}
passphrase: ${{ secrets.FLATPAK_GPG_PASSPHRASE }}
- name: Build Flutter
run: |
git config --global --add safe.directory /opt/hostedtoolcache/flutter/${{ matrix.channel }}-3.10.2-${{ matrix.arch }}
flutter config --enable-linux-desktop
flutter build linux --build-number $GITHUB_RUN_NUMBER --dart-define=COMMIT_HASH=$GITHUB_SHA --dart-define=SENTRY_DSN=${{ secrets.SENTRY_DSN }}
tar -czf com.expidusos.file_manager-linux-${{ matrix.arch }}.tar.gz -C build/linux/${{ matrix.arch }}/release/bundle/ .
- if: ${{ !github.event.issue.pull_request }}
uses: flatpak/flatpak-github-actions/[email protected]
name: Bundle Flatpak
with:
bundle: com.expidusos.file_manager.flatpak
manifest-path: data/com.expidusos.file_manager.yml
cache-key: flatpak-builder-${{ github.sha }}
gpg-sign: F1AE8F34E36642E92E7777B591654E1B742E4226
- if: ${{ github.event.issue.pull_request }}
uses: flatpak/flatpak-github-actions/[email protected]
name: Bundle Flatpak
with:
bundle: com.expidusos.file_manager.flatpak
manifest-path: data/com.expidusos.file_manager.yml
cache-key: flatpak-builder-${{ github.sha }}
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: com.expidusos.file_manager-linux-${{ matrix.arch }}
path: build/linux/${{ matrix.arch }}/release/bundle/
- if: startsWith(github.ref, 'refs/tags/')
name: Release
uses: meeDamian/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
allow_override: true
gzip: false
files: >
com.expidusos.file_manager.flatpak
com.expidusos.file_manager-linux-${{ matrix.arch }}.tar.gz
macos:
strategy:
matrix:
arch: [x64]
channel: [master]
runs-on: macos-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
cache: true
channel: ${{ matrix.channel }}
architecture: ${{ matrix.arch }}
- run: flutter doctor
- name: Download dependencies
run: flutter pub get
- name: Build desktop
run: |
flutter config --enable-macos-desktop
flutter build macos --build-number $GITHUB_RUN_NUMBER --dart-define=COMMIT_HASH=$GITHUB_SHA --dart-define=SENTRY_DSN=${{ secrets.SENTRY_DSN }}
find build
windows:
strategy:
matrix:
arch: [x64]
channel: [master]
runs-on: windows-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
cache: true
channel: ${{ matrix.channel }}
architecture: ${{ matrix.arch }}
- run: flutter doctor
- name: Download dependencies
run: flutter pub get
- name: Build desktop
run: |
flutter config --enable-windows-desktop
flutter build windows --release --build-number $GITHUB_RUN_NUMBER --dart-define=COMMIT_HASH=$GITHUB_SHA --dart-define=SENTRY_DSN=${{ secrets.SENTRY_DSN }}
pushd build/windows/x64/runner/Release
7z a ../../../../com.expidusos.file_manager-windows-${{ matrix.arch }}.zip . -r
popd
- name: Upload Windows
uses: actions/upload-artifact@v3
with:
name: com.expidusos.file_manager-windows-${{ matrix.arch }}.zip
path: build/windows/x64/runner/Release
- if: startsWith(github.ref, 'refs/tags/')
name: Release
uses: softprops/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
files: com.expidusos.file_manager-windows-${{ matrix.arch }}.zip