Skip to content

Commit 985fb31

Browse files
committed
feat: Add Linux package management and automated build support
- Add Debian/Ubuntu DEB package build support - Add Arch Linux package build support - Implement multi-architecture parallel builds (amd64/arm64) - Add GitHub Actions automated build and release - Update README with Linux distribution installation instructions - Remove original release-related content
1 parent 19fc436 commit 985fb31

File tree

14 files changed

+1303
-108
lines changed

14 files changed

+1303
-108
lines changed

.github/RELEASE_TEMPLATE.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Aictionary Release Template
2+
3+
## 新功能 ✨
4+
-
5+
6+
## 改进 🚀
7+
-
8+
9+
## 修复 🐛
10+
-
11+
12+
## 技术更新 🔧
13+
-
14+
15+
## 下载说明 📥
16+
17+
| 平台 | 自包含版本 | 框架依赖版本 |
18+
|------|------------|-------------|
19+
| Windows AMD64 | `Aictionary-windows-amd64.zip` | 包含在zip中 |
20+
| Windows ARM64 | `Aictionary-windows-arm64.zip` | 包含在zip中 |
21+
| macOS Intel | `Aictionary-macos-intel.tar.gz` | 包含在tar.gz中 |
22+
| macOS ARM64 | `Aictionary-macos-arm64.tar.gz` (包含DMG) | 包含在tar.gz中 |
23+
| Linux AMD64 | `Aictionary-linux-amd64.tar.gz` | 包含在tar.gz中 |
24+
| Linux ARM64 | `Aictionary-linux-arm64.tar.gz` | 包含在tar.gz中 |
25+
| Debian包 | `aictionary_*.deb` | - |
26+
| Arch包 | `aictionary-*.pkg.tar.zst` | - |
27+
28+
### 安装说明
29+
30+
**macOS用户:**
31+
- 推荐使用DMG文件安装
32+
- 将App拖入Applications文件夹
33+
34+
**Windows用户:**
35+
- 解压zip文件
36+
- 如果已安装.NET 8运行时,可选择框架依赖版本(体积更小)
37+
- 否则使用自包含版本
38+
39+
**Linux用户:**
40+
- Debian/Ubuntu: 使用 `sudo dpkg -i aictionary_*.deb` 安装deb包
41+
- Arch Linux: 使用 `sudo pacman -U aictionary-*.pkg.tar.zst` 安装
42+
- 其他发行版: 解压tar.gz文件直接运行
43+
44+
### 首次使用提示 💡
45+
- 别忘了在设置页配置OpenAI API Key
46+
- 当本地词库缺少词条时会调用大模型补充释义
47+
- 支持键盘快捷键快速查询、复制和刷新
48+
49+
---
50+
51+
**完整更新日志**: https://github.com/your-username/Aictionary/compare/v{previous_version}...v{current_version}

.github/workflows/build.yml

Lines changed: 306 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,306 @@
1+
name: Build and Package
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
tags: [ 'v*' ]
7+
pull_request:
8+
branches: [ main, master ]
9+
10+
jobs:
11+
build-linux:
12+
strategy:
13+
matrix:
14+
arch: [amd64, arm64]
15+
runs-on: ubuntu-22.04
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup .NET
21+
uses: actions/setup-dotnet@v4
22+
with:
23+
dotnet-version: '8.0.x'
24+
25+
- name: Build Linux ${{ matrix.arch }}
26+
run: |
27+
dotnet run --project build/build.csproj -- PublishLinux${{ matrix.arch == 'amd64' && 'Amd64' || 'Arm64' }}
28+
dotnet run --project build/build.csproj -- PublishLinux${{ matrix.arch == 'amd64' && 'Amd64' || 'Arm64' }}FrameworkDependent
29+
30+
- name: Create Linux tar.gz archives
31+
run: |
32+
cd artifacts
33+
if [ -d "linux-${{ matrix.arch }}" ]; then
34+
tar -czf "Aictionary-linux-${{ matrix.arch }}.tar.gz" -C "linux-${{ matrix.arch }}" .
35+
fi
36+
if [ -d "linux-${{ matrix.arch }}-framework-dependent" ]; then
37+
tar -czf "Aictionary-linux-${{ matrix.arch }}-framework-dependent.tar.gz" -C "linux-${{ matrix.arch }}-framework-dependent" .
38+
fi
39+
40+
- name: Upload Linux ${{ matrix.arch }} Artifacts
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: linux-${{ matrix.arch }}-packages
44+
path: |
45+
artifacts/*.tar.gz
46+
artifacts/linux-${{ matrix.arch }}/
47+
artifacts/linux-${{ matrix.arch }}-framework-dependent/
48+
49+
build-windows:
50+
strategy:
51+
matrix:
52+
arch: [amd64, arm64]
53+
runs-on: windows-latest
54+
55+
steps:
56+
- uses: actions/checkout@v4
57+
58+
- name: Setup .NET
59+
uses: actions/setup-dotnet@v4
60+
with:
61+
dotnet-version: '8.0.x'
62+
63+
- name: Build Windows ${{ matrix.arch }}
64+
run: |
65+
dotnet run --project build/build.csproj -- PublishWindows${{ matrix.arch == 'amd64' && 'Amd64' || 'Arm64' }}
66+
dotnet run --project build/build.csproj -- PublishWindows${{ matrix.arch == 'amd64' && 'Amd64' || 'Arm64' }}FrameworkDependent
67+
68+
- name: Create Windows ZIP archives
69+
run: |
70+
cd artifacts
71+
if (Test-Path "windows-${{ matrix.arch }}") {
72+
Compress-Archive -Path "windows-${{ matrix.arch }}\*" -DestinationPath "Aictionary-windows-${{ matrix.arch }}.zip"
73+
}
74+
if (Test-Path "windows-${{ matrix.arch }}-framework-dependent") {
75+
Compress-Archive -Path "windows-${{ matrix.arch }}-framework-dependent\*" -DestinationPath "Aictionary-windows-${{ matrix.arch }}-framework-dependent.zip"
76+
}
77+
78+
- name: Upload Windows ${{ matrix.arch }} Artifacts
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: windows-${{ matrix.arch }}-packages
82+
path: artifacts/*.zip
83+
84+
build-macos:
85+
strategy:
86+
matrix:
87+
arch: [intel, arm64]
88+
runs-on: macos-latest
89+
90+
steps:
91+
- uses: actions/checkout@v4
92+
93+
- name: Setup .NET
94+
uses: actions/setup-dotnet@v4
95+
with:
96+
dotnet-version: '8.0.x'
97+
98+
- name: Install create-dmg
99+
run: brew install create-dmg
100+
101+
- name: Build macOS ${{ matrix.arch }}
102+
run: |
103+
dotnet run --project build/build.csproj -- PublishMacOS${{ matrix.arch == 'intel' && 'Intel' || 'Arm64' }}
104+
dotnet run --project build/build.csproj -- PublishMacOS${{ matrix.arch == 'intel' && 'Intel' || 'Arm64' }}FrameworkDependent
105+
106+
- name: Create DMG for ${{ matrix.arch }}
107+
run: |
108+
if [ "${{ matrix.arch }}" = "arm64" ]; then
109+
dotnet run --project build/build.csproj -- CreateMacOSDmg
110+
else
111+
# Create DMG for Intel too
112+
dmg_file="artifacts/macos-${{ matrix.arch }}/Aictionary.dmg"
113+
app_bundle="artifacts/macos-${{ matrix.arch }}/Aictionary.app"
114+
if [ -d "$app_bundle" ]; then
115+
create-dmg --volname "Aictionary" --window-pos 200 120 --window-size 800 400 --icon-size 128 --app-drop-link 600 185 "$dmg_file" "$app_bundle"
116+
fi
117+
fi
118+
119+
- name: Upload macOS ${{ matrix.arch }} Artifacts
120+
uses: actions/upload-artifact@v4
121+
with:
122+
name: macos-${{ matrix.arch }}-packages
123+
path: artifacts/macos-${{ matrix.arch }}/*.dmg
124+
125+
build-deb:
126+
needs: build-linux
127+
strategy:
128+
matrix:
129+
type: [self-contained, framework-dependent]
130+
runs-on: ubuntu-22.04
131+
132+
steps:
133+
- uses: actions/checkout@v4
134+
135+
- name: Download Linux AMD64 Artifacts
136+
uses: actions/download-artifact@v4
137+
with:
138+
name: linux-amd64-packages
139+
path: artifacts/
140+
141+
- name: Download Linux ARM64 Artifacts
142+
uses: actions/download-artifact@v4
143+
with:
144+
name: linux-arm64-packages
145+
path: artifacts/
146+
147+
- name: Install packaging tools
148+
run: |
149+
sudo apt-get update
150+
sudo apt-get install -y dpkg-dev fakeroot
151+
152+
- name: Build DEB packages (${{ matrix.type }})
153+
run: |
154+
chmod +x scripts/build-deb.sh
155+
./scripts/build-deb.sh ${{ matrix.type }}
156+
157+
- name: Upload DEB packages
158+
uses: actions/upload-artifact@v4
159+
with:
160+
name: deb-packages-${{ matrix.type }}
161+
path: "aictionary*${{ matrix.type == 'framework-dependent' && '-framework-dependent' || '' }}_*_*.deb"
162+
163+
build-arch:
164+
needs: build-linux
165+
strategy:
166+
matrix:
167+
type: [self-contained, framework-dependent]
168+
runs-on: ubuntu-22.04
169+
container: archlinux:latest
170+
171+
steps:
172+
- name: Install dependencies
173+
run: |
174+
pacman -Syu --noconfirm
175+
pacman -S --noconfirm base-devel git dotnet-runtime
176+
177+
- uses: actions/checkout@v4
178+
179+
- name: Download Linux AMD64 Artifacts
180+
uses: actions/download-artifact@v4
181+
with:
182+
name: linux-amd64-packages
183+
path: artifacts/
184+
185+
- name: Download Linux ARM64 Artifacts
186+
uses: actions/download-artifact@v4
187+
with:
188+
name: linux-arm64-packages
189+
path: artifacts/
190+
191+
- name: Create non-root user for makepkg
192+
run: |
193+
useradd -m builder
194+
echo 'builder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
195+
chown -R builder:builder .
196+
197+
- name: Build Arch package (${{ matrix.type }})
198+
run: |
199+
chmod +x scripts/build-arch.sh
200+
sudo -u builder ./scripts/build-arch.sh ${{ matrix.type }}
201+
202+
- name: Upload Arch package
203+
uses: actions/upload-artifact@v4
204+
with:
205+
name: arch-packages-${{ matrix.type }}
206+
path: "aictionary*${{ matrix.type == 'framework-dependent' && '-framework-dependent' || '' }}-*-*.pkg.tar.zst"
207+
208+
release:
209+
if: startsWith(github.ref, 'refs/tags/v')
210+
needs: [build-linux, build-windows, build-macos, build-deb, build-arch]
211+
runs-on: ubuntu-latest
212+
permissions:
213+
contents: write
214+
215+
steps:
216+
- uses: actions/checkout@v4
217+
218+
- name: Download all artifacts
219+
uses: actions/download-artifact@v4
220+
with:
221+
path: release-artifacts
222+
223+
- name: List artifacts
224+
run: |
225+
echo "Available artifacts:"
226+
find release-artifacts -type f -name "*" | sort
227+
228+
- name: Create Release
229+
uses: actions/create-release@v1
230+
id: create_release
231+
env:
232+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
233+
with:
234+
tag_name: ${{ github.ref_name }}
235+
release_name: Aictionary ${{ github.ref_name }}
236+
draft: false
237+
prerelease: false
238+
body: |
239+
## 下载说明
240+
241+
### 桌面应用
242+
| 平台 | 自包含版本 | 框架依赖版本 |
243+
|------|------------|-------------|
244+
| Windows AMD64 | Aictionary-windows-amd64.zip | Aictionary-windows-amd64-framework-dependent.zip |
245+
| Windows ARM64 | Aictionary-windows-arm64.zip | Aictionary-windows-arm64-framework-dependent.zip |
246+
| macOS Intel | Aictionary-intel.dmg | - |
247+
| macOS ARM64 | Aictionary-arm64.dmg | - |
248+
| Linux AMD64 | Aictionary-linux-amd64.tar.gz | Aictionary-linux-amd64-framework-dependent.tar.gz |
249+
| Linux ARM64 | Aictionary-linux-arm64.tar.gz | Aictionary-linux-arm64-framework-dependent.tar.gz |
250+
251+
### Linux包管理器
252+
| 包类型 | 自包含版本 | 框架依赖版本 |
253+
|--------|------------|-------------|
254+
| Debian AMD64 | aictionary_*_amd64.deb | aictionary-framework-dependent_*_amd64.deb |
255+
| Debian ARM64 | aictionary_*_arm64.deb | aictionary-framework-dependent_*_arm64.deb |
256+
| Arch AMD64 | aictionary-*-x86_64.pkg.tar.zst | aictionary-framework-dependent-*-x86_64.pkg.tar.zst |
257+
| Arch ARM64 | aictionary-*-aarch64.pkg.tar.zst | aictionary-framework-dependent-*-aarch64.pkg.tar.zst |
258+
259+
**依赖说明:**
260+
- **自包含版本**:无需安装.NET运行时,体积较大
261+
- **框架依赖版本**:需要安装.NET 8运行时,体积较小
262+
263+
**安装.NET 8运行时:**
264+
- Windows: 从 [Microsoft官网](https://dotnet.microsoft.com/download/dotnet/8.0) 下载
265+
- Ubuntu/Debian: `sudo apt install dotnet-runtime-8.0`
266+
- Arch Linux: `sudo pacman -S dotnet-runtime`
267+
- macOS: `brew install dotnet`
268+
269+
- name: Upload all release assets
270+
run: |
271+
# Upload Windows ZIP files
272+
for zip in release-artifacts/windows-*-packages/*.zip; do
273+
if [ -f "$zip" ]; then
274+
gh release upload ${{ github.ref_name }} "$zip" --clobber
275+
fi
276+
done
277+
278+
# Upload Linux tar.gz files
279+
for tar in release-artifacts/linux-*-packages/*.tar.gz; do
280+
if [ -f "$tar" ]; then
281+
gh release upload ${{ github.ref_name }} "$tar" --clobber
282+
fi
283+
done
284+
285+
# Upload macOS DMG files
286+
for dmg in release-artifacts/macos-*-packages/*.dmg; do
287+
if [ -f "$dmg" ]; then
288+
gh release upload ${{ github.ref_name }} "$dmg" --clobber
289+
fi
290+
done
291+
292+
# Upload DEB packages (both types)
293+
for deb in release-artifacts/deb-packages-*/*.deb; do
294+
if [ -f "$deb" ]; then
295+
gh release upload ${{ github.ref_name }} "$deb" --clobber
296+
fi
297+
done
298+
299+
# Upload Arch packages (both types)
300+
for pkg in release-artifacts/arch-packages-*/*.pkg.tar.zst; do
301+
if [ -f "$pkg" ]; then
302+
gh release upload ${{ github.ref_name }} "$pkg" --clobber
303+
fi
304+
done
305+
env:
306+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
bin/
2-
obj/
1+
**/bin/
2+
**/obj/
33
/packages/
44
riderModule.iml
55
/_ReSharper.Caches/
66
Aictionary.sln.DotSettings.user
77
.DS_Store
8+
89
# NUKE Build
910
artifacts/
10-
.nuke/
11+
.nuke/temp/
12+
.tmp
1113
build/bin/
1214
build/obj/
13-
.tmp
15+
16+
# Keep NUKE configuration
17+
!.nuke/build.schema.json
18+
!.nuke/parameters.json

0 commit comments

Comments
 (0)