Skip to content

Build Postcompiler

Build Postcompiler #97

name: Build Postcompiler
on:
schedule:
- cron: '14 9 * * TUE' # Run at 9:14 (7:14pm local) on Tuesday
create:
ref_type: 'tag'
workflow_dispatch:
# Allow triggering manually whenever it's useful.
inputs:
ref:
description: 'Branch/tag/commit to use'
required: true
type: string
default: 'dev'
permissions:
contents: read
pull-requests: read
jobs:
freeze:
strategy:
fail-fast: false
matrix:
include:
# We want 3.8 because it works on Windows 7.
- artifact-name: 'win32'
python-version: '3.8.10'
arch: 'x86'
os: 'windows-latest'
- 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:
# Build dev on schedule, since it's actually changing.
- name: Checkout Dev
uses: actions/checkout@v3
if: github.event_name == 'schedule'
with:
ref: dev
# Always build the exact tag that's pushed.
- name: Checkout Tag
uses: actions/checkout@v3
if: github.event_name == 'create'
with:
ref: ${{ github.event.ref }}
- name: Checkout Ref
uses: actions/checkout@v3
if: github.event_name == 'workflow_dispatch'
with:
ref: ${{ inputs.ref }}
- name: Set up Python ${{ matrix.python-version }}-${{ matrix.arch }}
uses: actions/setup-python@v4
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: Freeze application
run: python -m PyInstaller --distpath ../build/ -y ../postcompiler.spec
working-directory: ./src/
- name: Artifact upload (tag)
uses: actions/upload-artifact@v3
if: github.event_name == 'create'
with:
name: hammeraddons_${{ github.event.ref }}_${{ matrix.artifact-name }}
path: ./build/
if-no-files-found: error
- name: Artifact upload (hash)
uses: actions/upload-artifact@v3
if: github.event_name != 'create'
with:
name: hammeraddons_${{ github.sha }}_${{ matrix.artifact-name }}
path: ./build/
if-no-files-found: error