chore: fix release yml #20
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*" | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
sudo apt-get update | |
sudo apt-get install -y libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev | |
elif [ "$RUNNER_OS" == "macOS" ]; then | |
brew install sdl2 sdl2_image sdl2_mixer sdl2_ttf | |
fi | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install pyinstaller | |
shell: bash | |
- name: Build with PyInstaller | |
run: | | |
if [ "${{ runner.os }}" == "Windows" ]; then | |
pyinstaller --onefile --windowed --add-data "images;images" --add-data "sounds;sounds" --icon=images/icon.ico --name patience main.py | |
elif [ "${{ runner.os }}" == "macOS" ]; then | |
pyinstaller --onefile --windowed --add-data "images:images" --add-data "sounds:sounds" --icon=images/icon.icns --name patience main.py | |
else | |
pyinstaller --onefile --windowed --add-data "images:images" --add-data "sounds:sounds" --name patience main.py | |
fi | |
shell: bash | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: patience-${{ matrix.os }} | |
path: | | |
dist/* | |
!dist/*.spec | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: Prepare release files | |
run: | | |
mkdir release_files | |
cp artifacts/patience-ubuntu-latest/patience release_files/patience-linux | |
cp artifacts/patience-windows-latest/patience.exe release_files/patience-windows.exe | |
cp artifacts/patience-macos-latest/patience release_files/patience-macos | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: release_files/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |