@@ -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
0 commit comments