fix 4 #5
Workflow file for this run
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
name: Build and Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag to upload assets to' | |
required: true | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest, macos-latest, ubuntu-latest] | |
python-version: [3.12.6] | |
name: Build App on ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: Viren070/EmuHaven | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pyinstaller | |
- name: Determine customtkinter path | |
id: determine-path | |
run: | | |
echo "CUSTOMTKINTER_PATH=$(python -c 'import customtkinter; print(customtkinter.__path__[0])')" >> $GITHUB_ENV | |
echo "CUSTOMTKINTER_PATH=${{ env.CUSTOMTKINTER_PATH }}" | |
- name: Build distributables | |
run: | | |
if [ -z "${{ env.CUSTOMTKINTER_PATH }}" ]; then | |
echo "CUSTOMTKINTER_PATH=${{ env.Python_ROOT_DIR }}/Lib/site-packages/customtkinter" >> $GITHUB_ENV | |
fi | |
pyinstaller --noconfirm --onedir --console --name "EmuHaven" --clean --add-data="${{ env.CUSTOMTKINTER_PATH }}:customtkinter/" --add-data="src/assets:assets/" src/main.py | |
- name: Create release archive | |
run: | | |
if [ "${{ matrix.os }}" == "windows-latest" ]; then | |
powershell -command "Compress-Archive -Path 'dist/EmuHaven/*' -DestinationPath 'dist/EmuHaven-${{ github.event_name == 'push' && github.ref_name || github.event.inputs.tag }}-win_x64.zip'" | |
elif [ "${{ matrix.os }}" == "macos-latest" ]; then | |
zip -r "dist/EmuHaven-${{ github.event_name == 'push' && github.ref_name || github.event.inputs.tag }}-macos_x64.zip" dist/EmuHaven | |
else | |
zip -r "dist/EmuHaven-${{ github.event_name == 'push' && github.ref_name || github.event.inputs.tag }}-linux_x64.zip" dist/EmuHaven | |
fi | |
shell: bash | |
- uses: "softprops/action-gh-release@v2" | |
env: | |
TAG: ${{ github.event_name == 'push' && github.ref_name || github.event.inputs.tag }} | |
with: | |
prerelease: ${{ contains(env.TAG, 'a') || contains(env.TAG, 'b') }} | |
tag_name: ${{ env.TAG }} | |
files: | | |
dist/EmuHaven-${{ github.event_name == 'push' && github.ref_name || github.event.inputs.tag }}-win_x64.zip | |
dist/EmuHaven-${{ github.event_name == 'push' && github.ref_name || github.event.inputs.tag }}-macos_x64.zip | |
dist/EmuHaven-${{ github.event_name == 'push' && github.ref_name || github.event.inputs.tag }}-linux_x64.zip |