-
Notifications
You must be signed in to change notification settings - Fork 53
231 lines (220 loc) · 9.01 KB
/
pr.yaml
File metadata and controls
231 lines (220 loc) · 9.01 KB
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
---
name: "PR workflow"
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
jobs:
flutter-build-android:
name: "Release for android"
runs-on: "ubuntu-latest"
permissions: write-all
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake libgtk-3-dev ninja-build libayatana-appindicator3-dev mpv libmpv-dev libasound2-dev
shell: bash
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version-file: pubspec.yaml
- name: Get Flutter dependencies
run: flutter pub get
shell: bash
- name: Generate i18n translations
run: dart run slang
shell: bash
- name: Generate MobX code
run: flutter pub run build_runner build --delete-conflicting-outputs
shell: bash
- name: Inject DanDan API Credentials
run: |
sed -i "s/kvpx7qkqjh/${{ secrets.DANDANAPI_APPID }}/g" lib/utils/mortis.dart
sed -i "s/rABUaBLqdz7aCSi3fe88ZDj2gwga9Vax/${{ secrets.DANDANAPI_KEY }}/g" lib/utils/mortis.dart
- name: Build Flutter for Android
run: flutter build apk --split-per-abi
shell: bash
- name: Package android build output
run: cp build/app/outputs/flutter-apk/app-arm64-v8a-release.apk oneAnime_android_canary.apk
shell: bash
- name: Upload android outputs
uses: actions/upload-artifact@v4
with:
name: android_outputs
path: oneAnime_android_*.apk
flutter-build-windows:
name: "Release for windows"
runs-on: "windows-latest"
permissions: write-all
steps:
- name: Clone repository
uses: actions/checkout@v4
- run: choco install yq
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version-file: pubspec.yaml
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '18'
- run: flutter pub get
- name: Generate i18n translations
run: dart run slang
- name: Generate MobX code
run: flutter pub run build_runner build --delete-conflicting-outputs
- name: Inject DanDan API Credentials
env:
DANDANAPI_APPID: ${{ secrets.DANDANAPI_APPID }}
DANDANAPI_KEY: ${{ secrets.DANDANAPI_KEY }}
run: |
(Get-Content -Path 'lib/utils/mortis.dart') -replace "kvpx7qkqjh", "$env:DANDANAPI_APPID" | Set-Content -Path 'lib/utils/mortis.dart'
(Get-Content -Path 'lib/utils/mortis.dart') -replace "rABUaBLqdz7aCSi3fe88ZDj2gwga9Vax", "$env:DANDANAPI_KEY" | Set-Content -Path 'lib/utils/mortis.dart'
- run: flutter build windows
- name: Download OpenCC Assets
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: 'Predidit/open_chinese_convert_bridge'
version: 'tags/1.0.0'
file: 'opencc_windows.zip'
token: ${{ secrets.GITHUB_TOKEN }}
- run: Expand-Archive -LiteralPath opencc_windows.zip -DestinationPath build/windows/x64/runner/Release
- run: Compress-Archive build/windows/x64/runner/Release/* oneAnime_windows_canary.zip
- name: Upload windows outputs
uses: actions/upload-artifact@v4
with:
name: windows_outputs
path: |
oneAnime_windows_*.zip
flutter-build-linux:
name: "Release for Linux"
runs-on: "ubuntu-latest"
permissions: write-all
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake libgtk-3-dev ninja-build libayatana-appindicator3-dev mpv unzip libmpv-dev libasound2-dev
shell: bash
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version-file: pubspec.yaml
- name: Get Flutter dependencies
run: flutter pub get
shell: bash
- name: Generate i18n translations
run: dart run slang
shell: bash
- name: Generate MobX code
run: flutter pub run build_runner build --delete-conflicting-outputs
shell: bash
- name: Inject DanDan API Credentials
run: |
sed -i "s/kvpx7qkqjh/${{ secrets.DANDANAPI_APPID }}/g" lib/utils/mortis.dart
sed -i "s/rABUaBLqdz7aCSi3fe88ZDj2gwga9Vax/${{ secrets.DANDANAPI_KEY }}/g" lib/utils/mortis.dart
- name: Build Flutter for Linux
run: flutter build linux
shell: bash
- name: Download OpenCC Assets
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: 'Predidit/open_chinese_convert_bridge'
version: 'tags/1.0.0'
file: 'opencc_linux.zip'
token: ${{ secrets.GITHUB_TOKEN }}
- run: unzip opencc_linux.zip -d build/linux/x64/release/bundle/lib
- name: Package linux build output
run: tar -zcvf oneAnime_linux_canary.tar.gz -C build/linux/x64/release/bundle .
shell: bash
- name: Upload linux outputs
uses: actions/upload-artifact@v4
with:
name: linux_outputs
path: oneAnime_linux_*.tar.gz
flutter-build-macos:
name: "Release for Macos"
runs-on: "macos-latest"
permissions: write-all
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version-file: pubspec.yaml
- run: flutter pub get
- name: Generate i18n translations
run: dart run slang
- name: Generate MobX code
run: flutter pub run build_runner build --delete-conflicting-outputs
- name: Inject DanDan API Credentials
run: |
sed -i '' "s/kvpx7qkqjh/${{ secrets.DANDANAPI_APPID }}/g" lib/utils/mortis.dart
sed -i '' "s/rABUaBLqdz7aCSi3fe88ZDj2gwga9Vax/${{ secrets.DANDANAPI_KEY }}/g" lib/utils/mortis.dart
- run: flutter build macos --release
- name: Create DMG
run: hdiutil create -format UDZO -srcfolder build/macos/Build/Products/Release/oneanime.app -volname oneanime oneAnime_macos_canary.dmg
- name: Upload MacOS build
uses: actions/upload-artifact@v4
with:
name: macos_outputs
path: oneAnime_macos_*.dmg
flutter-build-ios:
name: "Release for iOS"
runs-on: "macos-latest"
permissions: write-all
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Extract tag name
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Echo build progress
run: echo "oneAnime_ios_canary.ipa build progress"
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version-file: pubspec.yaml
- run: flutter pub get
- name: Generate i18n translations
run: dart run slang
- name: Generate MobX code
run: flutter pub run build_runner build --delete-conflicting-outputs
- name: Inject DanDan API Credentials
run: |
sed -i '' "s/kvpx7qkqjh/${{ secrets.DANDANAPI_APPID }}/g" lib/utils/mortis.dart
sed -i '' "s/rABUaBLqdz7aCSi3fe88ZDj2gwga9Vax/${{ secrets.DANDANAPI_KEY }}/g" lib/utils/mortis.dart
- name: Build IPA
run: |
flutter build ios --release --no-codesign
- name: Create IPA
run: |
mkdir Payload
cp -R build/ios/iphoneos/Runner.app Payload/Runner.app
zip -q -r oneAnime_ios_canary_no_sign.ipa Payload
- name: Upload iOS build
uses: actions/upload-artifact@v4
with:
name: ios_outputs
path: oneAnime_ios_*.ipa