Skip to content

Build square

Build square #4

Workflow file for this run

name: Build square
on:
workflow_dispatch:
inputs:
python_version:
required: true
type: string
default: '3.8' # Set default Python version here
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux, windows]
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ inputs.python_version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Run script
run: |
python square.py
- name: Build .exe for Windows and .out for Linux with PyInstaller
run: |
if [ "${{ matrix.platform }}" == "windows" ]; then
pip install pyinstaller
pyinstaller --onefile square.py
mv dist/square.exe square.exe
else
pip install pyinstaller
pyinstaller --onefile square.py
mv dist/square square.out
fi
- name: Upload Linux binary
if: matrix.platform == 'linux'
uses: actions/upload-artifact@v4
with:
name: square-linux
path: square.out
- name: Upload Windows binary
if: matrix.platform == 'windows'
uses: actions/upload-artifact@v4
with:
name: square-windows
path: square.exe