Build #52
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 | |
on: | |
push: | |
branches: [ master ] | |
paths-ignore: | |
- 'docs/**' | |
- '.github/workflows/publish-site.yml' | |
pull_request: | |
branches: [ master ] | |
paths-ignore: | |
- 'docs/**' | |
- '.github/workflows/publish-site.yml' | |
workflow_dispatch: | |
inputs: | |
version: | |
description: Version | |
env: | |
description: Environment | |
type: environment | |
required: true | |
default: "Production" | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- name: Windows | |
os: windows-latest | |
artifact: windows | |
upload_path_suffix: '/*' | |
reqs_file: requirements_full.txt | |
- name: Windows (Qt 5) | |
os: windows-latest | |
artifact: windows-qt5 | |
upload_path_suffix: '/*' | |
reqs_file: requirements_qt5_full.txt | |
- name: MacOS | |
os: macos-latest | |
artifact: macos | |
upload_path_suffix: '.zip' | |
reqs_file: requirements_full.txt | |
- name: Linux | |
os: ubuntu-latest | |
artifact: linux | |
upload_path_suffix: '/*' | |
reqs_file: requirements_full.txt | |
runs-on: ${{ matrix.os }} | |
environment: ${{ github.event.inputs.env || 'Development' }} | |
defaults: | |
run: | |
shell: bash | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
MACOSX_DEPLOYMENT_TARGET: 10.15 | |
steps: | |
- name: Checkout wwrando | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Add keys | |
run: | | |
echo "$SEED_KEY" > keys/seed_key.py | |
env: | |
SEED_KEY: ${{ secrets.SEED_KEY }} | |
- name: Set up Python | |
id: setup-py | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
check-latest: true | |
cache: 'pip' # Cache all pip dependency downloads | |
- name: Cache venv | |
id: cache-venv | |
uses: actions/cache@v4 | |
with: | |
path: ./.venv | |
key: ${{ runner.os }}-venv-${{ steps.setup-py.outputs.python-version }}-${{ matrix.reqs_file }}-${{ hashFiles('**/requirements*.txt') }} | |
- name: Create venv | |
if: steps.cache-venv.outputs.cache-hit != 'true' | |
run: | | |
python -m venv ./.venv | |
- name: Activate venv | |
run: | | |
source ./.venv/bin/activate || source ./.venv/Scripts/activate | |
echo $PATH >> $GITHUB_PATH | |
- name: Install venv dependencies | |
if: steps.cache-venv.outputs.cache-hit != 'true' | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r ${{ matrix.reqs_file }} | |
- name: Install any missing Qt dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y qtbase5-dev | |
sudo apt-get install -y libxcb-cursor0 | |
- name: Set variables | |
id: vars | |
run: | | |
USER_INPUT_VERSION=${{ github.event.inputs.version }} | |
TXT_VERSION=$(cat version.txt) | |
GIT_SHA_SHORT=$(git rev-parse --short=7 ${{ github.sha }}) | |
echo "full_version=${USER_INPUT_VERSION:-${TXT_VERSION}_${GIT_SHA_SHORT}}" >> $GITHUB_OUTPUT | |
- name: Set version | |
id: version | |
run: | | |
echo ${{ steps.vars.outputs.full_version }} > version.txt | |
- name: Build Python App | |
run: python -m PyInstaller --log-level=WARN wwrando.spec | |
- name: Bundle Python App | |
run: python build.py | |
- name: Upload Python App | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wwrando-${{ steps.vars.outputs.full_version }}-${{ matrix.artifact }} | |
path: dist/release_archive_${{ steps.vars.outputs.full_version }}_x64${{ matrix.upload_path_suffix }} |