update readme #19
This file contains hidden or 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 Executables | |
on: | |
push: | |
branches: | |
- main # Trigger the workflow on pushes to the main branch | |
pull_request: | |
branches: | |
- main # Also trigger on pull requests to the main branch | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12.3' # Choose your desired Python version | |
- name: Install dependencies | |
shell: bash | |
run: | | |
if [[ "$RUNNER_OS" == "Linux" ]]; then | |
sudo apt-get update | |
sudo apt-get install -y tk-dev | |
elif [[ "$RUNNER_OS" == "macOS" ]]; then | |
brew update | |
brew install tcl-tk | |
elif [[ "$RUNNER_OS" == "Windows" ]]; then | |
# No need to install tcl-tk for windows in this case | |
echo "Skipping tcl-tk install on Windows" | |
fi | |
python -m pip install --upgrade pip | |
pip install pyinstaller | |
pip install -r requirements.txt | |
- name: Build executable | |
shell: bash | |
run: | | |
if [[ "$RUNNER_OS" == "Linux" ]]; then | |
echo "Adding Tcl/Tk to LD_LIBRARY_PATH" | |
echo "LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH" >> $GITHUB_ENV | |
fi | |
pyinstaller --onefile --collect-all PIL backgroundremoval.py | |
- name: Rename executables | |
shell: bash | |
run: | | |
if [[ "$RUNNER_OS" == "Linux" ]]; then | |
mv dist/backgroundremoval dist/backgroundremoval-linux | |
elif [[ "$RUNNER_OS" == "Windows" ]]; then | |
mv dist/backgroundremoval.exe dist/backgroundremoval-windows.exe | |
elif [[ "$RUNNER_OS" == "macOS" ]]; then | |
mv dist/backgroundremoval dist/backgroundremoval-UNTESTED-macos | |
fi | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.os }}-executable | |
path: dist/* # Upload the generated executable from the 'dist' folder |