GitHub release workflow: add PYTHONPATH for current package to pyinst… #61
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 release | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
source-release: | |
name: Make source release | |
runs-on: ubuntu-20.04 | |
env: | |
GH_TOKEN: ${{ github.token }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install non-Python build dependencies | |
run: sudo apt-get -y install gettext | |
- name: Install Python dependencies | |
run: pip install tox build chambercourt | |
- name: Build | |
run: make dist | |
- name: Make the release | |
run: gh release create ${{ github.ref_name }} --title "Release ${{ github.ref_name}}" dist/* | |
binary-release: | |
name: Make binary release | |
needs: source-release | |
strategy: | |
matrix: | |
# Use oldest available macOS and Ubuntu for greatest compatibility | |
# of resulting binary. | |
os: [ubuntu-20.04, macos-13, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
env: | |
GH_TOKEN: ${{ github.token }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Python (Windows, macOS) | |
uses: actions/setup-python@v5 | |
if: ${{ matrix.os != 'ubuntu-20.04' }} | |
with: | |
python-version: "3.12" | |
- name: Install deadsnakes PPA (Ubuntu) | |
if: ${{ matrix.os == 'ubuntu-20.04' }} | |
uses: deadsnakes/[email protected] | |
with: | |
python-version: "3.12" | |
- name: Install non-Python build dependencies (Ubuntu) | |
if: ${{ matrix.os == 'ubuntu-20.04' }} | |
run: sudo apt-get -y install gettext | |
- name: Install non-Python build dependencies (Windows) | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
nuget install Gettext.Tools -Version 0.22.4 -OutputDirectory c:\nuget; | |
Add-Content $env:GITHUB_PATH "C:\nuget\Gettext.Tools.0.22.4\tools\bin"; | |
nuget install Magick.NET-Q16-AnyCPU -Version 14.3.0 -OutputDirectory c:\nuget; | |
Add-Content $env:GITHUB_PATH "C:\nuget\Magic.NET-Q16-AnyCPU.14.3.0\tools\bin" | |
- name: Install Python dependencies | |
run: pip install tox build setuptools chambercourt | |
- name: Install additional dependencies for binary builds | |
run: pip install pyinstaller | |
- name: Build | |
run: make dist | |
- name: Build the executable (Ubuntu) | |
if: ${{ matrix.os == 'ubuntu-20.04' }} | |
run: | | |
PYTHONPATH=. pyinstaller --noconfirm --onefile --windowed --name wincoll-${{ runner.os }}-${{ runner.arch }} --copy-metadata wincoll --add-data "wincoll/*.png:wincoll/" --add-data "wincoll/*.ttf:wincoll/" --add-data "wincoll/levels:wincoll/levels" --add-data "wincoll/locale:wincoll/locale" wincoll/__main__.py | |
./dist/wincoll-${{ runner.os }}-${{ runner.arch }} --help | |
- name: Build the executable (macOS) | |
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-latest' }} | |
run: | | |
./make-macos-icns ./wincoll/levels/Hero.png wincoll.iconset | |
pyi-makespec --windowed --name WinColl --icon wincoll.icns --copy-metadata wincoll --add-data "wincoll/*.png:wincoll/" --add-data "wincoll/*.ttf:wincoll/" --add-data "wincoll/levels:wincoll/levels" --add-data "wincoll/locale:wincoll/locale" wincoll/__main__.py | |
export version=$(grep version pyproject.toml) | |
sed -i '' -e "s/\(name='WinColl.app'\)/\1,\n $version/" wincoll.spec | |
PYTHONPATH=. pyinstaller --noconfirm wincoll.spec | |
brew install create-dmg | |
mkdir dmg-folder | |
mv dist/wincoll.app dmg-folder/ | |
create-dmg --volname "WinColl ${{ github.ref_name }}" ./dist/wincoll-${{ runner.os }}-${{ runner.arch }}.dmg dmg-folder/ | |
- name: Build the executable (Windows) | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
pip install cx_Freeze | |
cxfreeze bdist_msi | |
- name: Upload the binary (Ubuntu and macOS) | |
if: ${{ matrix.os != 'windows-latest' }} | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ github.token }} | |
tag: ${{ github.ref }} | |
file: ./dist/wincoll-${{ runner.os }}-${{ runner.arch }}* | |
file_glob: true | |
- name: Upload the binary (Windows) | |
if: ${{ matrix.os == 'windows-latest' }} | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ github.token }} | |
tag: ${{ github.ref }} | |
file: ./dist/wincoll*.msi | |
file_glob: true | |
- name: Build the RISC OS distribution | |
if: ${{ matrix.os == 'ubuntu-20.04' }} | |
run: ./dist-riscos | |
- name: Upload the RISC OS distribution | |
if: ${{ matrix.os == 'ubuntu-20.04' }} | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ github.token }} | |
tag: ${{ github.ref }} | |
file: ./dist/wincoll-riscos.zip | |
file_glob: true |