Skip to content

Commit c5bb198

Browse files
committed
add github ci, add return service info
1 parent 03592ac commit c5bb198

File tree

29 files changed

+1107
-287
lines changed

29 files changed

+1107
-287
lines changed

.github/workflows/release.yml

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
name: release
2+
3+
on:
4+
release:
5+
types: [published]
6+
paths:
7+
- "app/**"
8+
- "proto/**"
9+
- "server/**"
10+
- ".github/workflows/*.yml"
11+
12+
env:
13+
GO_VERSION: "1.23"
14+
NODE_VERSION: "20"
15+
FLUTTER_VERSION: "3.24.5"
16+
17+
jobs:
18+
get-version:
19+
runs-on: ubuntu-22.04
20+
outputs:
21+
version: ${{ steps.get-version.outputs.version }}
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Get version from pubspec.yaml
28+
id: get_version
29+
run: |
30+
VERSION=$(sed -n 's/^version: \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' app/pubspec.yaml)
31+
echo "version=$VERSION" >> $GITHUB_OUTPUT
32+
33+
build-macos-arm64-lib:
34+
needs:
35+
- get-version
36+
runs-on: macos-latest
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
41+
- name: Setup Go
42+
uses: actions/setup-go@v4
43+
with:
44+
go-version: ${{ env.GO_VERSION }}
45+
46+
- name: Build dylib
47+
env:
48+
VERSION: ${{ needs.get-version.outputs.version }}
49+
run: |
50+
cd server
51+
go build -ldflags="-w -s -X github.com/honmaple/maple-file/server/internal/app.VERSION=$env:VERSION" -buildmode=c-shared -o libserver.dylib github.com/honmaple/maple-file/server/cmd/desktop
52+
53+
- name: Upload dylib
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: macos-arm64-lib
57+
path: server/libserver.dylib
58+
59+
build-macos:
60+
needs:
61+
- get-version
62+
- build-macos-arm64-lib
63+
runs-on: macos-13
64+
steps:
65+
- name: Checkout
66+
uses: actions/checkout@v4
67+
68+
- name: Setup Go
69+
uses: actions/setup-go@v4
70+
with:
71+
go-version: ${{ env.GO_VERSION }}
72+
73+
- name: Setup Flutter
74+
uses: subosito/flutter-action@v2
75+
with:
76+
flutter-version: ${{ env.FLUTTER_VERSION }}
77+
78+
- name: Setup NPM
79+
uses: actions/setup-node@v4
80+
with:
81+
node-version: ${{ env.NODE_VERSION }}
82+
83+
- name: Install appdmg
84+
run: |
85+
python3 -m pip install setuptools --break-system-packages
86+
npm install -g appdmg
87+
88+
- name: Download arm64 dylib
89+
uses: actions/download-artifact@v4
90+
with:
91+
name: macos-arm64-lib
92+
path: server/arm64
93+
94+
- name: Build amd64 dylib
95+
env:
96+
VERSION: ${{ needs.get-version.outputs.version }}
97+
run: |
98+
cd server
99+
100+
go build -ldflags="-w -s -X github.com/honmaple/maple-file/server/internal/app.VERSION=$env:VERSION" -buildmode=c-shared -o libserver.dylib github.com/honmaple/maple-file/server/cmd/desktop
101+
102+
- name: Create dylib
103+
run: |
104+
mkdir -p app/macos/Frameworks
105+
cp server/libserver.dylib $PROJECT_DIR/app/macos/Frameworks/amd64-lib
106+
cp server/arm64/libserver.dylib $PROJECT_DIR/app/macos/Frameworks/arm64-lib
107+
108+
cd app/macos/Frameworks
109+
lipo -create -output libserver.dylib amd64-lib arm64-lib
110+
111+
- name: Build dmg
112+
env:
113+
VERSION: ${{ needs.get-version.outputs.version }}
114+
run: |
115+
cd app
116+
flutter pub get
117+
dart run build_runner build
118+
flutter build macos
119+
120+
cd $PROJECT_DIR/app/build/macos/Build/Products/Release
121+
cat>appdmg.json<<EOF
122+
{
123+
"title": "maple_file",
124+
"icon": "maple_file.app/Contents/Resources/AppIcon.icns",
125+
"contents": [
126+
{ "x": 448, "y": 344, "type": "link", "path": "/Applications" },
127+
{ "x": 192, "y": 344, "type": "file", "path": "maple_file.app" }
128+
]
129+
}
130+
EOF
131+
132+
mkdir dist
133+
appdmg appdmg.json dist/maple-file-$VERSION-macos.dmg
134+
135+
- name: Upload dmg file
136+
uses: actions/upload-artifact@v4
137+
with:
138+
name: macos-result
139+
path: app/build/macos/Build/Products/Release/dist/*.dmg
140+
141+
build-android:
142+
needs:
143+
- get-version
144+
runs-on: ubuntu-22.04
145+
146+
steps:
147+
- name: Checkout
148+
uses: actions/checkout@v4
149+
150+
- name: Setup Go
151+
uses: actions/setup-go@v4
152+
with:
153+
go-version: ${{ env.GO_VERSION }}
154+
155+
- name: Setup Java
156+
uses: actions/setup-java@v4
157+
with:
158+
distribution: 'temurin'
159+
java-version: '17'
160+
161+
- name: Setup Flutter
162+
uses: subosito/flutter-action@v2
163+
with:
164+
flutter-version: ${{ env.FLUTTER_VERSION }}
165+
166+
- name: Build Go aar
167+
env:
168+
VERSION: ${{ needs.get-version.outputs.version }}
169+
run: |
170+
mkdir app/android/app/libs
171+
172+
cd server
173+
go install golang.org/x/mobile/cmd/gomobile@latest
174+
go get golang.org/x/mobile/bind
175+
gomobile init
176+
gomobile bind -ldflags="-w -s -X github.com/honmaple/maple-file/server/internal/app.VERSION=$env:VERSION" -o ../app/android/app/libs/server.aar -target=android -androidapi 21 -javapkg="com.honmaple.maple_file" github.com/honmaple/maple-file/server/cmd/mobile
177+
178+
- name: Build APK
179+
env:
180+
VERSION: ${{ needs.get-version.outputs.version }}
181+
run: |
182+
cd app
183+
flutter pub get
184+
dart run build_runner build
185+
flutter build apk --no-tree-shake-icons --split-per-abi
186+
187+
cd build/app/outputs/flutter-apk
188+
mv app-x86_64-release.apk maple-file-$VERSION-android-x86_64.apk
189+
mv app-arm64-v8a-release.apk maple-file-$VERSION-android-arm64-v8a.apk
190+
mv app-armeabi-v7a-release.apk maple-file-$VERSION-android-armeabi-v7a.apk
191+
192+
- name: Upload APK
193+
uses: actions/upload-artifact@v4
194+
with:
195+
name: android-result
196+
path: |
197+
app/build/app/outputs/flutter-apk/maple-file-*.apk
198+
199+
release:
200+
needs:
201+
- build-macos
202+
- build_android
203+
runs-on: ubuntu-22.04
204+
205+
permissions:
206+
contents: write
207+
208+
steps:
209+
- name: Checkout
210+
uses: actions/checkout@v4
211+
212+
- name: Download dmg file
213+
uses: actions/download-artifact@v4
214+
with:
215+
name: macos-result
216+
path: macos-result
217+
218+
- name: Download apk file
219+
uses: actions/download-artifact@v4
220+
with:
221+
name: android-result
222+
path: android-result
223+
224+
- name: Release version
225+
uses: softprops/action-gh-release@v2
226+
if: github.event_name == 'release'
227+
with:
228+
files: |
229+
macos-result/*.dmg
230+
android-result/*.apk
231+
token: ${{ secrets.GITHUB_TOKEN }}

app/include/libserver.h

Lines changed: 0 additions & 87 deletions
This file was deleted.

app/lib/api/file/pages/setting_theme.dart

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,8 @@ class _FileSettingThemeState extends ConsumerState<FileSettingTheme> {
102102
],
103103
),
104104
onTap: () async {
105-
final result = await showListDialog2(
106-
context,
107-
height: MediaQuery.of(context).size.height / 2,
108-
child: const FileSettingHideFiles(),
109-
);
110-
if (result != null) {
111-
// ref.read(fileSettingProvider.notifier).update((state) {
112-
// if (result == setting.sort) {
113-
// return state.copyWith(
114-
// sortReversed: !state.sortReversed);
115-
// }
116-
// return state.copyWith(sort: result);
117-
// });
118-
}
105+
Navigator.of(context)
106+
.pushNamed("/file/setting/hidefiles");
119107
},
120108
),
121109
],

app/lib/api/file/route.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,8 @@ Future<void> init(CustomRouter router) async {
3939
'/file/setting/download': (context) {
4040
return const FileSettingDownload();
4141
},
42+
'/file/setting/hidefiles': (context) {
43+
return const FileSettingHideFiles();
44+
},
4245
});
4346
}

0 commit comments

Comments
 (0)