forked from Apricityx/PaddleScoreApp
-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (90 loc) · 3.47 KB
/
dart.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
name: Flutter Windows, Linux, and Android Release
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
# build-windows:
# runs-on: windows-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# - name: Set up Flutter
# uses: subosito/flutter-action@v2
# with:
# flutter-version: '3.x' # 根据需要指定 Flutter 版本
# - name: Enable Windows Desktop Support
# run: flutter config --enable-windows-desktop
# - name: Add Windows Platform Support
# run: flutter create --platforms=windows .
# - name: Install dependencies
# run: flutter pub get
# - name: Build Windows Release
# run: flutter build windows --release
# - name: Upload Windows Release Artifact
# uses: actions/upload-artifact@v4
# with:
# name: windows-release
# path: build/windows/x64/runner/Release/
# build-linux:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repository
# uses: actions/checkout@v4
# - name: Set up Flutter
# uses: subosito/flutter-action@v2
# with:
# flutter-version: '3.x' # 根据需要指定 Flutter 版本
# - name: Install dependencies for Linux build
# run: |
# sudo apt-get update
# sudo apt-get install -y cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
# - name: Enable Linux Desktop Support
# run: flutter config --enable-linux-desktop
# - name: Add Linux Platform Support
# run: flutter create --platforms=linux .
# - name: Install Flutter dependencies
# run: flutter pub get
# - name: Build Linux Release
# run: flutter build linux --release
# - name: Upload Linux Release Artifact
# uses: actions/upload-artifact@v4
# with:
# name: linux-release
# path: build/linux/x64/release/bundle/
build-android:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.x' # 根据需要指定 Flutter 版本
# 为避免旧 Android 工程问题,创建一个全新的 Flutter Android 项目
- name: Install Flutter dependencies (original project)
run: flutter pub get
- name: Create new Flutter Android project
run: flutter create -t app new_android_project
- name: Migrate code to new project
run: |
# 移除新项目自动生成的 lib 目录
rm -rf new_android_project/lib
# 将现有项目中的 lib 目录迁移过去
cp -R lib new_android_project/
# 用现有项目的 pubspec.yaml 替换新项目中的文件
cp pubspec.yaml new_android_project/
# 如果存在 assets 目录,也一起迁移
if [ -d assets ]; then cp -R assets new_android_project/; fi
- name: Install new project dependencies
working-directory: new_android_project
run: flutter pub get
- name: Build Android APK (new project)
working-directory: new_android_project
run: flutter build apk --release
- name: Upload Android APK Artifact
uses: actions/upload-artifact@v4
with:
name: android-apk
path: new_android_project/build/app/outputs/flutter-apk/app-release.apk