-
-
Notifications
You must be signed in to change notification settings - Fork 25
278 lines (227 loc) · 8.81 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
name: Build and Release AnymeX
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
generate-changelog:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate Changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
#!/bin/bash
PREVIOUS_TAG=$(git tag --sort=-v:refname | grep -vE '(-alpha|-beta|-rc)' | head -n 2 | tail -n 1)
CURRENT_TAG=${GITHUB_REF#refs/tags/}
if [ -z "$PREVIOUS_TAG" ]; then
PREVIOUS_TAG=$(git rev-list --max-parents=0 HEAD)
fi
# Initialize changelog with the current tag as the version
echo "# Changelog" > CHANGELOG.md
echo "## $CURRENT_TAG" >> CHANGELOG.md
echo "" >> CHANGELOG.md
# Function to add section if commits exist
add_section() {
local section_title="$1"
local grep_pattern="$2"
local commits=$(git log $PREVIOUS_TAG..$CURRENT_TAG --grep="$grep_pattern" --pretty=format:'* [`%h`](https://github.com/RyanYuuki/AnymeX/commit/%h): %s')
if [ ! -z "$commits" ]; then
echo "## $section_title" >> CHANGELOG.md
echo "$commits" >> CHANGELOG.md
echo "" >> CHANGELOG.md
fi
}
# Add sections dynamically
add_section "🎉 New Features" "^feat:"
add_section "🛠️ Bug Fixes & Improvements" "^fix:"
add_section "🔧 Refactors" "^refactor:"
add_section "🎨 Style Changes" "^style:"
add_section "🚀 Performance Improvements" "^perf:"
add_section "🧹 Chores & Documentation" "^(chore|docs):"
# Output the generated changelog
cat CHANGELOG.md
- name: Update Release with Changelog
uses: ncipollo/release-action@v1
with:
bodyFile: "CHANGELOG.md"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
build-android:
runs-on: ubuntu-latest
needs: generate-changelog
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: "adopt"
java-version: "17"
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.22.3"
- name: Get Dependencies
run: flutter pub get
- name: Build Android with Split ABI
run: flutter build apk --split-per-abi
- name: Rename APKs
run: |
mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk build/app/outputs/flutter-apk/AnymeX-Android-armeabi-v7a.apk
mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk build/app/outputs/flutter-apk/AnymeX-Android-arm64.apk
mv build/app/outputs/flutter-apk/app-x86_64-release.apk build/app/outputs/flutter-apk/AnymeX-Android-x86_64.apk
- name: Build Universal APK
run: flutter build apk --release
- name: Rename Universal APK
run: mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/AnymeX-Android-universal.apk
- name: Release Android APKs
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/flutter-apk/AnymeX-Android-*.apk"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
tag: ${{ github.ref_name }}
build-ios:
runs-on: macos-latest
needs: generate-changelog
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.22.3"
- name: Get Dependencies
run: flutter pub get
- name: Build iOS
run: |
flutter build ios --release --no-codesign
cd build/ios/iphoneos
mkdir -p Payload
cd Payload
ln -s ../Runner.app
cd ..
zip -r AnymeX-iOS-${{ github.ref_name }}.ipa Payload
mv AnymeX-iOS-${{ github.ref_name }}.ipa ../../../
- name: Release iOS IPA
uses: ncipollo/release-action@v1
with:
artifacts: "AnymeX-iOS-*.ipa"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
tag: ${{ github.ref_name }}
build-linux:
runs-on: ubuntu-latest
needs: generate-changelog
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y ninja-build cmake g++ libgtk-3-dev libblkid-dev liblzma-dev pkg-config libmpv-dev libwebkit2gtk-4.1-dev
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.22.3"
- name: Replace pubspec.yaml with Desktop Version
run: cp pubspec_desktop.yaml pubspec.yaml
- name: Get Dependencies
run: flutter pub get
- name: Replace video file extensions for desktops
run: |
mv lib/pages/Desktop/video_controls.darts lib/pages/Desktop/video_controls.dart
mv lib/pages/Desktop/watch_page.darts lib/pages/Desktop/watch_page.dart
- name: Replace main.dart with Desktop Version
run: mv lib/main.darts lib/main.dart
- name: Build Linux
run: flutter build linux --release
- name: Zip Linux Artifacts
run: |
cd build/linux/x64/release/bundle
zip -r ../../../../../AnymeX-Linux.zip .
- name: Release Linux Build
uses: ncipollo/release-action@v1
with:
artifacts: "AnymeX-Linux.zip"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
tag: ${{ github.ref_name }}
build-windows:
runs-on: windows-latest
needs: generate-changelog
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.22.3"
- name: Replace pubspec.yaml with Desktop Version
run: Copy-Item -Path pubspec_desktop.yaml -Destination pubspec.yaml -Force
- name: Replace main.dart with Desktop Version
run: Move-Item -Path lib\main.darts -Destination lib\main.dart -Force
- name: Replace video file extensions for desktops
run: |
Move-Item -Path lib\pages\Desktop\video_controls.darts -Destination lib\pages\Desktop\video_controls.dart -Force
Move-Item -Path lib\pages\Desktop\watch_page.darts -Destination lib\pages\Desktop\watch_page.dart -Force
- name: Get Dependencies
run: flutter pub get
- name: Build Windows
run: flutter build windows --release
- name: Create ZIP file for Windows Build
run: |
cd build/windows/x64/runner/Release
Compress-Archive -Path * -DestinationPath AnymeX-Windows.zip
- name: Setup Inno Setup
run: choco install innosetup -y
- name: Build Installer with Inno Setup
run: |
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" inno.iss
- name: Release Windows Builds
uses: ncipollo/release-action@v1
with:
artifacts: "build/windows/x64/runner/Release/AnymeX-Windows.zip,output/AnymeX-Setup.exe"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
tag: ${{ github.ref_name }}
build-macos:
runs-on: macos-latest
needs: generate-changelog
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.22.3"
- name: Replace pubspec.yaml with Desktop Version
run: cp pubspec_macos.yaml pubspec.yaml
- name: Replace main.dart with Desktop Version
run: mv lib/main.darts lib/main.dart
- name: Replace video file extensions for desktops
run: |
mv lib/pages/Desktop/video_controls.darts lib/pages/Desktop/video_controls.dart
mv lib/pages/Desktop/watch_page.darts lib/pages/Desktop/watch_page.dart
mv lib/auth/auth_provider_macos.dart lib/auth/auth_provider.dart
- name: Get Dependencies
run: flutter pub get
- name: Build macOS
run: flutter build macos --release
- name: Create DMG file for macOS Build
run: |
mkdir -p build/macos/Release
hdiutil create -volname "AnymeX" -srcfolder build/macos/Build/Products/Release/AnymeX.app -ov -format UDZO build/macos/Release/AnymeX.dmg
- name: Release macOS Builds
uses: ncipollo/release-action@v1
with:
artifacts: "build/macos/Release/AnymeX.dmg"
token: ${{ secrets.GITHUB_TOKEN }}
allowUpdates: true
tag: ${{ github.ref_name }}