Build Postcompiler #13
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 Postcompiler | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Release version' | |
required: true | |
jobs: | |
freeze: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- artifact-name: 'win64' | |
python-version: '3.11' | |
arch: 'x64' | |
os: 'windows-latest' | |
# - artifact-name: 'linux64' | |
# python-version: '3.11' | |
# arch: 'x64' | |
# os: 'ubuntu-latest' | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }}-${{ matrix.arch }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: ${{ matrix.arch }} | |
cache: 'pip' | |
cache-dependency-path: 'requirements.txt' | |
- name: Install srctools | |
run: | | |
python -m pip install -U setuptools pip wheel | |
python -m pip install -r requirements.txt | |
- name: Build assets | |
run: | | |
mkdir build | |
mkdir build/bin | |
mkdir build/bin/win64 | |
mkdir build/hammer | |
python src/hammeraddons/build_fgd_assets.py -i patch_postcompiler.fgd -o build/hammer -a hammer | |
robocopy hammer/scripts build/hammer/scripts /S /PURGE | |
robocopy hammer/materials/tools build/hammer/materials/tools /S /PURGE | |
- name: Freeze application | |
run: python -m PyInstaller --distpath ../build/bin/win64 -y ../postcompiler.spec | |
working-directory: ./src/ | |
- name: Zip hammeraddons_${{ matrix.artifact-name }} | |
uses: thedoctor0/zip-release@master | |
with: | |
type: 'zip' | |
directory: ./build/ | |
filename: 'hammeraddons_${{ matrix.artifact-name }}.zip' | |
- name: Artifact upload (tag) | |
uses: actions/upload-artifact@v4 | |
if: github.event_name == 'create' | |
with: | |
name: hammeraddons_${{ github.event.inputs.version }}_${{ matrix.artifact-name }} | |
path: ./build/hammeraddons_${{ matrix.artifact-name }}.zip | |
if-no-files-found: error | |
- name: Artifact upload (hash) | |
uses: actions/upload-artifact@v4 | |
if: github.event_name != 'create' | |
with: | |
name: hammeraddons_${{ github.event.inputs.version }}_${{ matrix.artifact-name }} | |
path: ./build/hammeraddons_${{ matrix.artifact-name }}.zip | |
if-no-files-found: error | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ github.event.inputs.version }} | |
files: | | |
./build/hammeraddons_${{ matrix.artifact-name }}.zip | |
fail_on_unmatched_files: true |