Skip to content

Dev

Dev #513

Workflow file for this run

name: Build Executable
on:
push:
branches:
- main
- dev
tags:
- "v**"
pull_request:
branches:
- main
- dev
workflow_dispatch:
permissions:
contents: write
jobs:
build-ubuntu:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
if: github.event.pull_request.draft == false
- name: Set VERSION_NUMBER
run: |
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
echo "VERSION_NUMBER=${{ github.ref_name }}" >> $GITHUB_ENV
else
echo "VERSION_NUMBER=" >> $GITHUB_ENV
fi
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Locate Python and pip
run: |
echo "Python path: $(which python3.10)"
echo "Pip path: $(python3.10 -m site --user-site)"
- name: Install dependencies and Build executable on Ubuntu
run: |
python3.10 -m venv venv
python3.10 -m pip install --upgrade pip
source venv/bin/activate
pip install -r requirements.txt
pip install pyinstaller
scriptPath="${{ github.workspace }}/blocknet_aio_monitor.py"
cmd=(pyinstaller --noconfirm --onefile \
--hidden-import='PIL._tkinter_finder' \
--add-data "theme:theme" \
--add-data "img:img" \
--clean \
"$scriptPath")
echo "Running command:"
printf ' %q' "${cmd[@]}"
echo
"${cmd[@]}"
mv dist/blocknet_aio_monitor dist/blocknet_aio_monitor-${{ env.VERSION_NUMBER }}-x86-64-linux
- uses: actions/upload-artifact@v4
with:
name: artifacts-linux
path: |
dist/blocknet_aio_monitor-*
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
name: blocknet_aio_monitor ${{ github.ref_name}}
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
generate_release_notes: true
files: |
dist/blocknet_aio_monitor-*
build-macos-13:
runs-on: macos-13
steps:
- uses: actions/checkout@v3
if: github.event.pull_request.draft == false
- name: Set VERSION_NUMBER
run: |
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
echo "VERSION_NUMBER=${{ github.ref_name }}" >> $GITHUB_ENV
else
echo "VERSION_NUMBER=" >> $GITHUB_ENV
fi
- name: Set up Python using Homebrew
run: |
brew update
brew upgrade || true
brew link --overwrite python@3.12
brew install python
brew install python-tk
python3 -m pip install --upgrade pip
# brew install python@3.10
# brew install python-tk@3.10
# python3.10 -m pip install --upgrade pip
- name: Install dependencies / Build executable on macOS
run: |
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install pyinstaller
scriptPath="${{ github.workspace }}/blocknet_aio_monitor.py"
cmd=(pyinstaller --noconfirm --onefile \
--add-data "theme:theme" \
--add-data "img:img" \
--clean \
"$scriptPath")
echo "Running command:"
printf ' %q' "${cmd[@]}"
echo
"${cmd[@]}"
mkdir -p my_bin
mv dist/blocknet_aio_monitor my_bin/blocknet_aio_monitor
- name: Create DMG file
run: |
mkdir -p dmg
hdiutil create -volname "Blocknet AIO Monitor" -format UDRW -ov -srcfolder my_bin -o dmg/blocknet_aio_monitor-macos-base.dmg
hdiutil convert dmg/blocknet_aio_monitor-macos-base.dmg -format UDZO -o dmg/blocknet_aio_monitor-${{ env.VERSION_NUMBER }}-x86-64-macos.dmg
- uses: actions/upload-artifact@v4
with:
name: artifacts-macos-13
path: |
dmg/blocknet_aio_monitor-${{ env.VERSION_NUMBER }}-x86-64-macos.dmg
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
name: blocknet_aio_monitor ${{ github.ref_name}}
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
generate_release_notes: true
files: |
dmg/blocknet_aio_monitor-${{ env.VERSION_NUMBER }}-x86-64-macos.dmg
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
if: github.event.pull_request.draft == false
- name: Set VERSION_NUMBER
run: |
if ($env:GITHUB_REF -like 'refs/tags/v*') {
$VERSION_NUMBER = $env:GITHUB_REF -replace 'refs/tags/', ''
Write-Host "Extracted tag: $VERSION_NUMBER"
} else {
$VERSION_NUMBER = ""
}
echo "VERSION_NUMBER=$VERSION_NUMBER" >> $env:GITHUB_ENV
- name: Debug VERSION_NUMBER
run: |
Write-Host "DEBUG: VERSION_NUMBER = $env:VERSION_NUMBER"
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Locate Python and pip
run: |
$pythonPath = (Get-Command python).Path
$pipPath = (Get-Command pip).Path
Write-Host "Python path: $pythonPath"
Write-Host "Pip path: $pipPath"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m venv venv
venv\Scripts\activate.bat
pip install -r requirements.txt
pip install pyinstaller
- name: Build executable on Windows
run: |
$scriptPath = "$env:GITHUB_WORKSPACE\blocknet_aio_monitor.py"
$command = "pyinstaller --noconfirm --onefile --log-level=DEBUG --add-data `"theme:theme`" --add-data `"img:img`" --clean `"$scriptPath`""
Write-Host "Running: $command"
Invoke-Expression $command
- name: Rename executable
run: |
$newName = "${{ github.workspace }}/dist/blocknet_aio_monitor-$env:VERSION_NUMBER-x86-64-windows.exe"
Write-Host "DEBUG: New filename = $newName"
Rename-Item -Path "${{ github.workspace }}/dist/blocknet_aio_monitor.exe" -NewName $newName
Write-Host "DEBUG: Rename command executed successfully"
- uses: actions/upload-artifact@v4
with:
name: artifacts-win
path: |
dist/blocknet_aio_monitor-${{ env.VERSION_NUMBER }}-x86-64-windows.exe
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
name: blocknet_aio_monitor ${{ github.ref_name}}
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
generate_release_notes: true
files: |
dist/blocknet_aio_monitor-${{ env.VERSION_NUMBER }}-x86-64-windows.exe