Skip to content

Build binaries

Build binaries #90

Workflow file for this run

name: Build binaries
on:
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
compiler: [nuitka, pyinstaller]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.MAC_SIGN_CERT }}
P12_PASSWORD: ${{ secrets.MAC_SIGN_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.MAC_KEYCHAIN_PASSWORD }}
shell: bash
run: |
export FK_VERSION=$(scripts/common/get-version.sh)
echo "FK_VERSION=$FK_VERSION" >> $GITHUB_ENV
if [[ "$OSTYPE" == "darwin"* ]]; then
scripts/macos/install-create-dmg.sh
scripts/macos/install-certificates.sh
export BINARY_EXTENSION=""
echo "BINARY_EXTENSION=" >> $GITHUB_ENV
elif [[ "$OSTYPE" == "msys" ]]; then
scripts/windows/install-innosetup.sh
export BINARY_EXTENSION=".exe"
echo "BINARY_EXTENSION=.exe" >> $GITHUB_ENV
else
scripts/linux/appimage/install-appimage.sh
export BINARY_EXTENSION=""
echo "BINARY_EXTENSION=" >> $GITHUB_ENV
fi
pip install -r requirements.txt
if [[ "${{ matrix.compiler}}" == "nuitka" ]]; then
pip install nuitka
else
pip install pyinstaller
fi
- name: Prepare sources
shell: bash
run: |
scripts/common/generate-resources.sh
rm -rf build dist
mkdir -p build dist
- name: Package builds (PyInstaller)
if: ${{ matrix.compiler == 'pyinstaller' }}
shell: bash
run: |
if [[ "$OSTYPE" == "darwin"* ]]; then
pyinstaller scripts/common/pyinstaller/normal.spec --distpath=build -- --sign
echo "Built PyInstaller for macOS"
ls -al build/
else
pyinstaller scripts/common/pyinstaller/portable.spec --distpath=build
pyinstaller scripts/common/pyinstaller/normal.spec --distpath=build
echo "Built PyInstaller for Linux or Windows"
ls -al build/
fi
- name: Package builds (Nuitka)
if: ${{ matrix.compiler == 'nuitka' }}
uses: Nuitka/Nuitka-Action@main
with:
nuitka-version: main
script-name: src/fk/desktop/desktop.py
# This might be "standalone" or "app" for macOS
mode: onefile
enable-plugins: pyside6
windows-console-mode: disable
windows-icon-from-ico: res/flowkeeper.ico
macos-app-icon: flowkeeper.icns
macos-signed-app-name: org.flowkeeper.Flowkeeper
macos-app-name: Flowkeeper
macos-app-mode: gui
macos-sign-identity: "Developer ID Application: Constantine Kulak (ELWZ9S676C)"
macos-app-version: "${{ env.FK_VERSION }}"
product-name: Flowkeeper
product-version: "${{ env.FK_VERSION }}"
file-description: Flowkeeper is a Pomodoro Technique desktop timer for power users
copyright: Copyright (c) 2023 Constantine Kulak <[email protected]>
output-dir: 'build'
output-file: 'Flowkeeper'
env:
PYTHONPATH: src
- name: Create installers
env:
NOTARIZATION_PASSWORD: ${{ secrets.MAC_NOTARIZATION_PASSWORD }}
NOTARIZATION_ID: ${{ secrets.MAC_NOTARIZATION_ID }}
NOTARIZATION_TEAM: ${{ secrets.MAC_NOTARIZATION_TEAM }}
shell: bash
run: |
echo "Prepare dist directory"
mkdir -p dist/standalone
PREFIX="dist/flowkeeper-${FK_VERSION}-${{ matrix.os }}-${{ matrix.compiler }}"
echo "Will create artifacts with $PREFIX prefix"
if [[ "${{ matrix.compiler}}" == "nuitka" ]]; then
mv build/Flowkeeper* $PREFIX-portable${BINARY_EXTENSION}
mv build/desktop.dist/* dist/standalone
if [[ "$OSTYPE" == "linux"* ]]; then
mv dist/standalone/Flowkeeper.bin dist/standalone/Flowkeeper
fi
else
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "macOS doesn't support portable binaries"
ls -al build/Flowkeeper.app
mv build/Flowkeeper.app dist/standalone
else
mv build/Flowkeeper${BINARY_EXTENSION} $PREFIX-portable${BINARY_EXTENSION}
mv build/flowkeeper/* dist/standalone
fi
fi
echo "Moved ${{ matrix.compiler }} binaries to dist/standalone"
ls -al dist/
ls -al dist/standalone
if [[ "$OSTYPE" == "darwin"* ]]; then
echo "Building macOS DMG installer"
scripts/macos/create-dmg.sh
scripts/macos/notarize-dmg.sh
mv dist/Flowkeeper.dmg "$PREFIX-installer.dmg"
elif [[ "$OSTYPE" == "msys" ]]; then
echo "Building Windows setup.exe installer"
scripts/windows/package-installer.sh
mv dist/setup.exe "$PREFIX-installer.exe"
else
echo "Building Debian "fat" DEB package"
scripts/linux/debian/package-deb.sh
mv dist/flowkeeper.deb "$PREFIX-package.deb"
echo "Building Debian "lean" DEB package"
scripts/linux/debian/package-deb-min.sh
mv dist/flowkeeper-min.deb "$PREFIX-min-package.deb"
# Temporarily disable AppImage build
# echo "Building AppImage package"
# scripts/linux/appimage/package-appimage.sh
# mv dist/org.flowkeeper.Flowkeeper.AppImage "$PREFIX-portable.AppImage"
fi
echo "Zipping the standalone directory"
cd standalone
zip -9 -r "$PREFIX-standalone.zip" ./*
cd ..
echo "Cleaning /dist up"
rm -rf standalone
- name: Archive the binaries
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}-${{ matrix.compiler }}-all
path: |
dist