-
Notifications
You must be signed in to change notification settings - Fork 20
288 lines (235 loc) · 10.8 KB
/
build.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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
name: Build Fladder
on:
push:
tags:
- "v*"
branches:
- master
workflow_dispatch:
jobs:
# build-android:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/[email protected]
# - name: Decode Keystore
# env:
# ENCODED_STRING: ${{ secrets.KEYSTORE_BASE_64 }}
# RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
# RELEASE_KEYSTORE_ALIAS: ${{ secrets.RELEASE_KEYSTORE_ALIAS }}
# RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
# GITHUB_RUN_NUMBER: ${{ github.run_number }}
# run: |
# echo "$ENCODED_STRING" | base64 -d > android/app/keystore.jks
# # Create the key.properties file
# cat > android/app/key.properties <<EOF
# storePassword=$RELEASE_KEYSTORE_PASSWORD
# keyPassword=$RELEASE_KEY_PASSWORD
# keyAlias=$RELEASE_KEYSTORE_ALIAS
# EOF
# - name: Setup Java
# uses: actions/setup-java@v4
# with:
# distribution: "zulu"
# java-version: "17"
# cache: "gradle"
# check-latest: true
# - name: Set up Flutter
# uses: subosito/[email protected]
# with:
# channel: ${{ vars.FLUTTER_CHANNEL }}
# flutter-version: ${{ vars.FLUTTER_VERSION }}
# cache: true
# cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
# cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:"
# - name: Get dependencies
# run: flutter pub get
# - name: Build Android APK and AAB
# run: |
# APP_NAME=$(grep '^name:' pubspec.yaml | cut -d ':' -f2 | tr -d ' ')
# VERSION_NAME=$(grep '^version:' pubspec.yaml | cut -d ':' -f2 | cut -d '+' -f1 | tr -d ' ')
# echo "APP_NAME=$APP_NAME" >> $GITHUB_ENV
# echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
# # Build APK
# flutter build apk --release \
# --build-name=$VERSION_NAME \
# --build-number=$GITHUB_RUN_NUMBER \
# --dart-define=FLAVOR=release
# # Build AAB
# flutter build appbundle --release \
# --build-name=$VERSION_NAME \
# --build-number=$GITHUB_RUN_NUMBER \
# --dart-define=FLAVOR=release
# - name: Rename APK and AAB
# run: |
# mv build/app/outputs/flutter-apk/app-release.apk "build/app/outputs/flutter-apk/${{ env.APP_NAME }}-${{ env.VERSION_NAME }}-signed.apk"
# mv build/app/outputs/bundle/release/app-release.aab "build/app/outputs/bundle/release/${{ env.APP_NAME }}-${{ env.VERSION_NAME }}-signed.aab"
# - name: Archive Android artifacts
# uses: actions/[email protected]
# with:
# name: ${{ env.APP_NAME }}-Android-${{ env.VERSION_NAME }}
# path: |
# build/app/outputs/flutter-apk/${{ env.APP_NAME }}-${{ env.VERSION_NAME }}-signed.apk
# build/app/outputs/bundle/release/${{ env.APP_NAME }}-${{ env.VERSION_NAME }}-signed.aab
# build-windows:
# #Use windows-2019, latest(2022) causes MSVCP140.dll related crashes
# runs-on: windows-2019
# steps:
# - name: Checkout repository
# uses: actions/[email protected]
# - name: Set up Flutter
# uses: subosito/[email protected]
# with:
# channel: ${{ vars.FLUTTER_CHANNEL }}
# flutter-version: ${{ vars.FLUTTER_VERSION }}
# cache: true
# cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache
# cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
# - name: Get dependencies
# run: flutter pub get
# - name: Build Windows EXE
# run: |
# $pubspec = Get-Content pubspec.yaml
# $APP_NAME = ($pubspec | Select-String '^name:' | ForEach-Object { ($_ -split ':')[1].Trim() })
# $VERSION_NAME = ($pubspec | Select-String '^version:' | ForEach-Object { ($_ -split ':')[1].Trim().Split('+')[0] })
# echo "APP_NAME=$APP_NAME" >> $Env:GITHUB_ENV
# echo "VERSION_NAME=$VERSION_NAME" >> $Env:GITHUB_ENV
# flutter build windows --build-name=$VERSION_NAME --build-number=${{ github.run_number }}
# - name: Archive Windows artifact
# uses: actions/[email protected]
# with:
# name: ${{ env.APP_NAME }}-Windows-${{ env.VERSION_NAME }}
# path: build\windows\x64\runner\Release\
# build-ios:
# runs-on: macos-latest
# steps:
# - name: Checkout repository
# uses: actions/[email protected]
# - name: Set up Flutter
# uses: subosito/[email protected]
# with:
# channel: ${{ vars.FLUTTER_CHANNEL }}
# flutter-version: ${{ vars.FLUTTER_VERSION }}
# cache: true
# cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to specify the cache path
# cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
# - name: Get dependencies
# run: flutter pub get
# - name: Build iOS app
# run: |
# APP_NAME=$(grep '^name:' pubspec.yaml | cut -d ':' -f2 | tr -d ' ')
# VERSION_NAME=$(grep '^version:' pubspec.yaml | cut -d ':' -f2 | cut -d '+' -f1 | tr -d ' ')
# echo "PACKAGE_NAME=$APP_NAME-iOS-$VERSION_NAME" >> $GITHUB_ENV
# flutter build ipa --no-codesign --build-name=$VERSION_NAME --build-number=${{ github.run_number }}
# - name: Create unsigned IPA
# run: |
# cd build/ios/archive/Runner.xcarchive/Products/Applications/
# mkdir Payload
# mv Runner.app Payload/
# zip -r ${{ env.PACKAGE_NAME }}.ipa Payload
# - name: Archive iOS IPA artifact
# uses: actions/[email protected]
# with:
# name: ${{ env.PACKAGE_NAME }}
# path: build/ios/archive/Runner.xcarchive/Products/Applications/${{ env.PACKAGE_NAME }}.ipa
# build-macos:
# runs-on: macos-latest
# steps:
# - name: Checkout repository
# uses: actions/[email protected]
# - name: Set up Flutter
# uses: subosito/[email protected]
# with:
# channel: ${{ vars.FLUTTER_CHANNEL }}
# flutter-version: ${{ vars.FLUTTER_VERSION }}
# cache: true
# cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache
# cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
# - name: Get dependencies
# run: flutter pub get
# - name: Build macOS app
# run: |
# APP_NAME=$(grep '^name:' pubspec.yaml | cut -d ':' -f2 | tr -d ' ')
# VERSION_NAME=$(grep '^version:' pubspec.yaml | cut -d ':' -f2 | cut -d '+' -f1 | tr -d ' ')
# echo "PACKAGE_NAME=$APP_NAME-macOS-$VERSION_NAME" >> $GITHUB_ENV
# flutter build macos --build-name=$VERSION_NAME --build-number=${{ github.run_number }}
# - name: Create DMG file
# run: |
# hdiutil create -format UDZO -srcfolder build/macos/Build/Products/Release/fladder.app build/macos/Build/Products/Release/${{ env.PACKAGE_NAME }}.dmg
# - name: Archive macOS artifact
# uses: actions/[email protected]
# with:
# name: ${{ env.PACKAGE_NAME }}
# path: build/macos/Build/Products/Release/${{ env.PACKAGE_NAME }}.dmg
# build-linux:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/[email protected]
# - name: Set up Flutter
# uses: subosito/[email protected]
# with:
# channel: ${{ vars.FLUTTER_CHANNEL }}
# flutter-version: ${{ vars.FLUTTER_VERSION }}
# cache: true
# cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache
# cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
# - name: Get dependencies
# run: flutter pub get
# - name: Get packages
# run: |
# sudo apt-get update -y
# sudo apt-get install -y ninja-build libgtk-3-dev libmpv-dev
# - name: Build Linux app
# run: |
# APP_NAME=$(grep '^name:' pubspec.yaml | cut -d ':' -f2 | tr -d ' ')
# VERSION_NAME=$(grep '^version:' pubspec.yaml | cut -d ':' -f2 | cut -d '+' -f1 | tr -d ' ')
# echo "APP_NAME=$APP_NAME" >> $GITHUB_ENV
# echo "VERSION_NAME=$VERSION_NAME" >> $GITHUB_ENV
# # Build APK
# flutter build linux --release \
# --build-name=$VERSION_NAME \
# --build-number=${{ github.run_number }}
# - name: Archive Linux artifact
# uses: actions/upload-artifact@v4
# with:
# name: ${{ env.APP_NAME }}-Linux-${{ env.VERSION_NAME }}
# path: build/linux/x64/release/bundle
build-web:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Set up Flutter
uses: subosito/[email protected]
with:
channel: ${{ vars.FLUTTER_CHANNEL }}
flutter-version: ${{ vars.FLUTTER_VERSION }}
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:" # optional, change this to force refresh cache
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:" # optional, change this to specify the cache path
- name: Get dependencies
run: flutter pub get
- name: Build web app
run: |
APP_NAME=$(grep '^name:' pubspec.yaml | cut -d ':' -f2 | tr -d ' ')
VERSION_NAME=$(grep '^version:' pubspec.yaml | cut -d ':' -f2 | cut -d '+' -f1 | tr -d ' ')
echo "PACKAGE_NAME=$APP_NAME-Web-$VERSION_NAME" >> $GITHUB_ENV
flutter build web --base-href /${{ github.event.repository.name }}/ --release --build-number=$GITHUB_RUN_NUMBER
- name: Archive web artifact
uses: actions/[email protected]
with:
name: ${{ env.PACKAGE_NAME }}
path: build/web
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub Actions
publish_dir: ./build/web
- name: Deploy docker
uses: mr-smithers-excellent/docker-build-push@v6
with:
image: donutware/fladder
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}