Skip to content

Commit e406afe

Browse files
committed
ci: add linux installer release artifacts
1 parent 3ed29f0 commit e406afe

2 files changed

Lines changed: 118 additions & 2 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 106 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,92 @@ jobs:
193193
cp resources/linux/onetcli-512.png package/usr/share/icons/hicolor/512x515/apps/onetcli.png
194194
tar czf ${{ matrix.archive }} -C package .
195195
196+
- name: Install Linux packaging dependencies
197+
if: matrix.target == 'x86_64-unknown-linux-gnu'
198+
run: |
199+
sudo apt-get update
200+
sudo apt-get install -y rpm
201+
202+
- name: Package Linux installers (x86_64)
203+
if: matrix.target == 'x86_64-unknown-linux-gnu'
204+
shell: bash
205+
run: |
206+
set -euo pipefail
207+
208+
PACKAGE_VERSION="${ONETCLI_VERSION//-/.}"
209+
DEB_NAME="onetcli_${PACKAGE_VERSION}_amd64.deb"
210+
RPM_NAME="onetcli-${PACKAGE_VERSION}-1.x86_64.rpm"
211+
APPIMAGE_NAME="onetcli_${PACKAGE_VERSION}_amd64.AppImage"
212+
213+
rm -rf package-deb rpmbuild OnetCli.AppDir linuxdeploy-x86_64.AppImage
214+
215+
mkdir -p package-deb/DEBIAN
216+
cp -a package/. package-deb/
217+
cat > package-deb/DEBIAN/control <<EOF
218+
Package: onetcli
219+
Version: ${PACKAGE_VERSION}
220+
Section: utils
221+
Priority: optional
222+
Architecture: amd64
223+
Maintainer: feigeCode <noreply@github.com>
224+
Homepage: https://github.com/feigeCode/onetcli
225+
Description: One Net Client - Database, SSH, Terminal, AI Tools
226+
EOF
227+
dpkg-deb --root-owner-group --build package-deb "${DEB_NAME}"
228+
229+
RPM_ROOT="${PWD}/rpmbuild"
230+
mkdir -p "${RPM_ROOT}"/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
231+
tar czf "${RPM_ROOT}/SOURCES/onetcli-${PACKAGE_VERSION}.tar.gz" -C package .
232+
cat > "${RPM_ROOT}/SPECS/onetcli.spec" <<EOF
233+
Name: onetcli
234+
Version: ${PACKAGE_VERSION}
235+
Release: 1%{?dist}
236+
Summary: One Net Client - Database, SSH, Terminal, AI Tools
237+
License: Apache-2.0
238+
URL: https://github.com/feigeCode/onetcli
239+
BuildArch: x86_64
240+
Source0: %{name}-%{version}.tar.gz
241+
242+
%description
243+
One Net Client - Database, SSH, Terminal, AI Tools.
244+
245+
%prep
246+
mkdir -p %{_builddir}/%{name}-%{version}
247+
tar -xzf %{SOURCE0} -C %{_builddir}/%{name}-%{version}
248+
249+
%build
250+
251+
%install
252+
mkdir -p %{buildroot}
253+
cp -a %{_builddir}/%{name}-%{version}/* %{buildroot}/
254+
255+
%files
256+
/usr/bin/onetcli
257+
/usr/share/applications/onetcli.desktop
258+
/usr/share/icons/hicolor/128x128/apps/onetcli.png
259+
/usr/share/icons/hicolor/256x256/apps/onetcli.png
260+
/usr/share/icons/hicolor/512x515/apps/onetcli.png
261+
EOF
262+
rpmbuild --define "_topdir ${RPM_ROOT}" -bb "${RPM_ROOT}/SPECS/onetcli.spec"
263+
generated_rpm="$(find "${RPM_ROOT}/RPMS" -name "onetcli-${PACKAGE_VERSION}-1*.x86_64.rpm" -print -quit)"
264+
test -n "${generated_rpm}"
265+
cp "${generated_rpm}" "${RPM_NAME}"
266+
267+
mkdir -p OnetCli.AppDir
268+
cp -a package/. OnetCli.AppDir/
269+
curl -L -o linuxdeploy-x86_64.AppImage \
270+
https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
271+
chmod +x linuxdeploy-x86_64.AppImage
272+
VERSION="${PACKAGE_VERSION}" APPIMAGE_EXTRACT_AND_RUN=1 ./linuxdeploy-x86_64.AppImage \
273+
--appdir OnetCli.AppDir \
274+
--executable OnetCli.AppDir/usr/bin/onetcli \
275+
--desktop-file resources/linux/onetcli.desktop \
276+
--icon-file package/usr/share/icons/hicolor/512x515/apps/onetcli.png \
277+
--output appimage
278+
generated_appimage="$(find . -maxdepth 1 -name '*.AppImage' ! -name 'linuxdeploy-x86_64.AppImage' -print -quit)"
279+
test -n "${generated_appimage}"
280+
mv "${generated_appimage}" "${APPIMAGE_NAME}"
281+
196282
- name: Package (Windows)
197283
if: runner.os == 'Windows'
198284
shell: pwsh
@@ -214,6 +300,16 @@ jobs:
214300
name: onetcli-${{ matrix.target }}.dmg
215301
path: "*.dmg"
216302

303+
- name: Upload Linux installer artifacts
304+
if: matrix.target == 'x86_64-unknown-linux-gnu'
305+
uses: actions/upload-artifact@v4
306+
with:
307+
name: onetcli-linux-x86_64-installers
308+
path: |
309+
onetcli_*.deb
310+
onetcli-*.rpm
311+
onetcli_*.AppImage
312+
217313
release:
218314
name: Create Release
219315
needs: build
@@ -235,7 +331,13 @@ jobs:
235331
- name: Generate checksums
236332
run: |
237333
cd artifacts
238-
sha256sum onetcli-* > sha256sums.txt
334+
shopt -s nullglob
335+
release_files=(onetcli-* onetcli_*)
336+
if [ "${#release_files[@]}" -eq 0 ]; then
337+
echo "::error::No release artifacts found for checksum generation"
338+
exit 1
339+
fi
340+
sha256sum "${release_files[@]}" > sha256sums.txt
239341
cat sha256sums.txt
240342
241343
- name: Write release metadata
@@ -265,4 +367,7 @@ jobs:
265367
artifacts/onetcli-*.tar.gz
266368
artifacts/onetcli-*.zip
267369
artifacts/onetcli-*.dmg
370+
artifacts/onetcli_*.deb
371+
artifacts/onetcli-*.rpm
372+
artifacts/onetcli_*.AppImage
268373
artifacts/sha256sums.txt

‎docs/download.md‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,22 @@ OnetCli 当前下载入口统一托管在 GitHub Releases。推荐先下载桌
1414
| 平台 | 架构 | 渲染 |
1515
| --- | --- | --- |
1616
| macOS | Apple Silicon、Intel | Metal |
17-
| Linux | x86_64 | Vulkan |
17+
| Linux | x86_64、ARM64 | Vulkan |
1818
| Windows | x86_64 | 原生桌面窗口 |
1919

2020
> 实际可下载包以 GitHub Releases 中当前发布的文件为准。
2121
22+
## Linux 包格式
23+
24+
Linux x86_64 发布包包含通用归档和发行版安装包:
25+
26+
- `onetcli-x86_64-unknown-linux-gnu.tar.gz`:应用内自动更新和通用手动安装使用。
27+
- `onetcli_<version>_amd64.deb`:Ubuntu、Debian、Linux Mint 等 Debian 系发行版使用。
28+
- `onetcli-<version>-1.x86_64.rpm`:Fedora、RHEL、CentOS、openSUSE 等 RPM 系发行版使用。
29+
- `onetcli_<version>_amd64.AppImage`:不确定发行版或偏好便携运行时使用。
30+
31+
Linux ARM64 当前提供 `onetcli-aarch64-unknown-linux-gnu.tar.gz`。
32+
2233
## 下载后可以先体验什么
2334

2435
1. 打开 OnetCli,创建一个数据库连接。

0 commit comments

Comments
 (0)