Build binaries #82
This file contains hidden or 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 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 -- --sign --distpath=build | |
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 | |
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-version: "${{ env.FK_VERSION }}" | |
macos-app-name: Flowkeeper | |
macos-sign-identity: "Developer ID Application: Constantine Kulak (ELWZ9S676C)" | |
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 | |
PORTABLE_FILENAME="dist/flowkeeper-${FK_VERSION}-${{ matrix.os }}-${{ matrix.compiler }}-portable${BINARY_EXTENSION}" | |
echo "Will output portable to $PORTABLE_FILENAME" | |
if [[ "${{ matrix.compiler}}" == "nuitka" ]]; then | |
mv build/Flowkeeper* $PORTABLE_FILENAME | |
mv build/desktop.dist dist/standalone | |
else | |
mv build/flowkeeper/Flowkeeper${BINARY_EXTENSION} $PORTABLE_FILENAME | |
mv build/flowkeeper/_internal dist/standalone/_internal | |
fi | |
echo "Moved ${{ matrix.compiler }} binaries to dist/standalone" | |
ls -al dist/standalone | |
if [[ "$OSTYPE" == "darwin"* ]]; then | |
scripts/macos/create-dmg.sh | |
scripts/macos/notarize-dmg.sh | |
elif [[ "$OSTYPE" == "msys" ]]; then | |
scripts/windows/package-installer.sh | |
else | |
scripts/linux/debian/package-deb.sh | |
scripts/linux/appimage/package-appimage.sh | |
fi | |
- name: Archive portable single-file build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.os }}-${{ matrix.compiler }}-portable | |
path: | | |
dist/Flowkeeper* | |
- name: Archive portable build ZIP | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.os }}-${{ matrix.compiler }}-zip | |
path: | | |
dist/standalone | |
- name: Archive Windows installer | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.os }}-${{ matrix.compiler }}-installers | |
path: | | |
dist/setup*.exe | |
- name: Archive AppImage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.os }}-${{ matrix.compiler }}-AppImage | |
path: | | |
dist/*.AppImage | |
- name: Archive DEB package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.os }}-${{ matrix.compiler }}-deb | |
path: | | |
dist/flowkeeper.deb |