-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main'
- Loading branch information
Showing
1 changed file
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
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 |