Skip to content

modified: .github/workflows/build_installers.yml #16

modified: .github/workflows/build_installers.yml

modified: .github/workflows/build_installers.yml #16

name: Build Netleaf Installers
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
output_extension: [deb, rpm]
- os: windows-latest
output_extension: [exe]
- os: macos-latest
output_extension: [dmg]
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install nuitka imageio pyqtdarktheme
pip list
- name: Get version from folder name
id: get_version
run: |
VERSION=$(ls -d Netleaf\ v*/ | sed 's/Netleaf v\(.*\)\//\1/')
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Build with Nuitka
run: |
python -m nuitka --standalone --onefile \
--include-data-dir="Netleaf v${{ env.VERSION }}/resources=resources" \
--include-package-data=PySide6 \
--include-package-data=pyqtdarktheme \
--include-package=PySide6 \
--include-package=pyqtdarktheme \
--follow-imports \
--windows-icon-from-ico="Netleaf v${{ env.VERSION }}/resources/icon.png" \
--disable-console \
--assume-yes-for-downloads \
--verbose \
"Netleaf v${{ env.VERSION }}/main.py"
- name: Create Windows Installer
if: matrix.os == 'windows-latest'
run: |
choco install nsis -y
echo '
!include "MUI2.nsh"
Name "Netleaf v${{ env.VERSION }}"
OutFile "Netleaf Setup v${{ env.VERSION }}.exe"
InstallDir "$PROGRAMFILES\Netleaf"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
Section
SetOutPath $INSTDIR
File /r "main.dist\*.*"
CreateShortCut "$DESKTOP\Netleaf.lnk" "$INSTDIR\main.exe"
WriteUninstaller "$INSTDIR\uninstall.exe"
SectionEnd
Section "Uninstall"
Delete "$DESKTOP\Netleaf.lnk"
RMDir /r "$INSTDIR"
SectionEnd
' > installer.nsi
makensis installer.nsi
- name: Create macOS DMG
if: matrix.os == 'macos-latest'
run: |
mkdir -p dist/dmg
cp -R main.dist dist/dmg/Netleaf.app
hdiutil create -volname "Netleaf v${{ env.VERSION }}" -srcfolder dist/dmg -ov -format UDZO "Netleaf Setup v${{ env.VERSION }}.dmg"
- name: Create Debian Package
if: matrix.os == 'ubuntu-latest'
run: |
mkdir -p netleaf_${{ env.VERSION }}/DEBIAN
mkdir -p netleaf_${{ env.VERSION }}/usr/local/bin/netleaf
cp -R main.dist/* netleaf_${{ env.VERSION }}/usr/local/bin/netleaf/
echo "Package: netleaf
Version: ${{ env.VERSION }}
Section: utils
Priority: optional
Architecture: amd64
Maintainer: Niamorro
Description: Netleaf Application
Network scanning tool.
" > netleaf_${{ env.VERSION }}/DEBIAN/control
dpkg-deb --build netleaf_${{ env.VERSION }}
mv netleaf_${{ env.VERSION }}.deb "Netleaf Setup v${{ env.VERSION }}.deb"
- name: Create RPM Package
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install rpm -y
mkdir -p ~/rpmbuild/{SPECS,SOURCES,BUILD,RPMS,SRPMS}
echo "Name: netleaf
Version: ${{ env.VERSION }}
Release: 1
Summary: Netleaf Application
License: GPLv3
%description
Network scanning tool.
%prep
# No source unpacking needed
%install
mkdir -p %{buildroot}/usr/local/bin/netleaf
cp -R main.dist/* %{buildroot}/usr/local/bin/netleaf/
%files
/usr/local/bin/netleaf/*
%changelog
* $(date '+%a %b %d %Y') Niamorro <> - ${{ env.VERSION }}-1
- Initial RPM release" > ~/rpmbuild/SPECS/netleaf.spec
rpmbuild -bb ~/rpmbuild/SPECS/netleaf.spec
mv ~/rpmbuild/RPMS/x86_64/netleaf-${{ env.VERSION }}-1.x86_64.rpm "Netleaf Setup v${{ env.VERSION }}.rpm"
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: Netleaf Setup v${{ env.VERSION }}
path: Netleaf Setup v${{ env.VERSION }}.*
if-no-files-found: error