Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
fperdigon committed Feb 5, 2025
2 parents c7bd59b + 2df670d commit 7c6e306
Showing 1 changed file with 114 additions and 0 deletions.
114 changes: 114 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Build PyInstaller Executable

on:
push:
branches:
- main
release:
types: [created]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Define Executable Name
run: echo "EXE_NAME=AI4Kids-Laser-Eyes" >> $GITHUB_ENV # Set the variable

- name: Build executable
run: |
pyinstaller pyinstaller_recipe.spec
shell: bash # Needed for Windows compatibility

- name: Rename Windows Binary
if: matrix.os == 'windows-latest'
run: mv dist/${{ env.EXE_NAME }}.exe dist/${{ env.EXE_NAME }}-windows.exe

- name: Rename Linux Binary
if: matrix.os == 'ubuntu-latest'
run: mv dist/${{ env.EXE_NAME }} dist/${{ env.EXE_NAME }}-linux.bin

- name: Rename macOS Binary
if: matrix.os == 'macos-latest'
run: mv dist/${{ env.EXE_NAME }} dist/${{ env.EXE_NAME }}-macos.bin

- name: Upload Artifact (Windows)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: windows-binary
path: dist/${{ env.EXE_NAME }}-windows.exe

- name: Upload Artifact (Linux)
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: linux-binary
path: dist/${{ env.EXE_NAME }}-linux.bin

- name: Upload Artifact (macOS)
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: macos-binary
path: dist/${{ env.EXE_NAME }}-macos.bin # Upload renamed macOS binary

release:
needs: build # Waits for the build job to finish
runs-on: ubuntu-latest

steps:
- name: Define Executable Name
run: echo "EXE_NAME=AI4Kids-Laser-Eyes" >> $GITHUB_ENV # Set the variable

- name: Download Windows binary
uses: actions/download-artifact@v4
with:
name: windows-binary
path: dist/

- name: Download Linux binary
uses: actions/download-artifact@v4
with:
name: linux-binary
path: dist/

- name: Download macOS binary
uses: actions/download-artifact@v4
with:
name: macos-binary
path: dist/

- name: Upload Release Asset
uses: softprops/action-gh-release@v2
with:
files: |
dist/${{ env.EXE_NAME }}-windows.exe
dist/${{ env.EXE_NAME }}-linux.bin
dist/${{ env.EXE_NAME }}-macos.bin
- name: Upload "Latest" Build
uses: softprops/action-gh-release@v2
with:
tag_name: latest
files: |
dist/${{ env.EXE_NAME }}-windows.exe
dist/${{ env.EXE_NAME }}-linux.bin
dist/${{ env.EXE_NAME }}-macos.bin

0 comments on commit 7c6e306

Please sign in to comment.