modified: .github/workflows/build_installers.yml #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Installers | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v2 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install nuitka | |
- name: Extract version | |
id: get_version | |
run: echo "version=${GITHUB_WORKSPACE##*_}" >> $GITHUB_ENV | |
- name: Build with Nuitka | |
run: | | |
mkdir -p dist | |
nuitka --onefile --include-data-dir="Netleaf v${{ env.version }}/resources=resources" "Netleaf v${{ env.version }}/main.py" --output-dir=dist | |
- name: Package for Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
mv "dist/main.exe" "dist/Netleaf Setup v${{ env.version }}.exe" | |
- name: Package for macOS | |
if: matrix.os == 'macos-latest' | |
run: | | |
# Create a .dmg using hdiutil or any other suitable tool | |
hdiutil create -volname "Netleaf Setup v${{ env.version }}" -srcfolder dist -ov -format UDZO "dist/Netleaf Setup v${{ env.version }}.dmg" | |
- name: Package for Linux (deb) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
# Install FPM for packaging | |
sudo apt-get install -y ruby ruby-dev rubygems build-essential | |
sudo gem install --no-document fpm | |
# Create .deb package | |
fpm -s dir -t deb -n "netleaf" -v "${{ env.version }}" --license "GPLv3" --maintainer "Niamorro" --description "Netleaf Application" --after-install <(echo '#!/bin/bash\nexit 0') --after-remove <(echo '#!/bin/bash\nexit 0') dist/=/ | |
- name: Package for Linux (rpm) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
# Create .rpm package | |
fpm -s dir -t rpm -n "netleaf" -v "${{ env.version }}" --license "GPLv3" --maintainer "Niamorro" --description "Netleaf Application" --after-install <(echo '#!/bin/bash\nexit 0') --after-remove <(echo '#!/bin/bash\nexit 0') dist/=/ | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: installers | |
path: dist/ |