Skip to content

Release-Executable

Release-Executable #77

Workflow file for this run

name: Release-Executable
# Pyinstaller requires that executables for each OS are built on that OS
# This action is intended to build on each of the supported OS's: mac, windows, linux.
# and then upload all three files to a new release
# reference material:
# https://data-dive.com/multi-os-deployment-in-cloud-using-pyinstaller-and-github-actions
# https://anshumanfauzdar.medium.com/using-github-actions-to-bundle-python-application-into-a-single-package-and-automatic-release-834bd42e0670
on:
release:
types: [published]
workflow_dispatch:
jobs:
buildexe:
name: Build executables and upload them to the existing release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
TARGET: windows
CMD_BUILD: >
pyinstaller tabcmd-windows.spec --clean --noconfirm --distpath ./dist/windows
OUT_FILE_NAME: tabcmd.exe
ASSET_MIME: application/vnd.microsoft.portable-executable
- os: macos-latest
TARGET: macos
CMD_BUILD: >
pyinstaller tabcmd-mac.spec --clean --noconfirm --distpath ./dist/macos
OUT_FILE_NAME: tabcmd.app
ASSET_MIME: application/zip
- os: ubuntu-latest
TARGET: ubuntu
# https://stackoverflow.com/questions/31259856
# /how-to-create-an-executable-file-for-linux-machine-using-pyinstaller
CMD_BUILD: >
pyinstaller --clean -y --distpath ./dist/ubuntu tabcmd-linux.spec &&
chown -R --reference=. ./dist/ubuntu
OUT_FILE_NAME: tabcmd
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies and build
run: |
python --version
python -m pip install --upgrade pip
python -m pip install --upgrade build
pip install .
pip install .[package]
doit version
python -m build
- name: Package with pyinstaller for ${{matrix.TARGET}}
run: ${{matrix.CMD_BUILD}}
- name: Validate package for ${{matrix.TARGET}}
if: matrix.TARGET != 'macos'
run: ./dist/${{ matrix.TARGET }}/${{matrix.OUT_FILE_NAME}}
- name: Validate package for ${{matrix.TARGET}}
if: matrix.TARGET == 'macos'
run: ./dist/${{ matrix.TARGET }}/${{matrix.OUT_FILE_NAME}}/Contents/MacOS/tabcmd
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.OUT_FILE_NAME }}
path: ./dist/${{ matrix.TARGET }}/${{ matrix.OUT_FILE_NAME }}