Skip to content

Build & Release

Build & Release #9

Workflow file for this run

name: Build & Release
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g., v1.2.3)'
required: true
type: string
permissions:
contents: read
concurrency:
group: release-${{ inputs.tag || github.ref_name }}
cancel-in-progress: false
env:
PYTHON_VERSION: '3.14'
SPEC_PATH: 'tchMaterial-parser.spec'
DIST_DIR: 'dist'
jobs:
build-linux:
name: Build (Linux)
runs-on: ${{ matrix.runs_on }}
strategy:
fail-fast: false
matrix:
include:
- runs_on: ubuntu-latest
artifact_name: tchMaterial-parser-linux-x64
- runs_on: ubuntu-24.04-arm
artifact_name: tchMaterial-parser-linux-arm64
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
cache-dependency-path: requirements.txt
- name: Create virtual environment
run: python -m venv .venv
- name: Install dependencies
run: |
./.venv/bin/python -m pip install --upgrade pip
./.venv/bin/python -m pip install pyinstaller -r requirements.txt
- name: Build app
run: |
./.venv/bin/python -m PyInstaller ${{ env.SPEC_PATH }}
mv "${{ env.DIST_DIR }}/tchMaterial-parser" "${{ env.DIST_DIR }}/${{ matrix.artifact_name }}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ env.DIST_DIR }}/${{ matrix.artifact_name }}
if-no-files-found: error
build-windows:
name: Build (Windows)
runs-on: windows-latest
defaults:
run:
shell: pwsh
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
cache-dependency-path: requirements.txt
- name: Create virtual environment
run: python -m venv .venv
- name: Install dependencies
run: |
.\.venv\Scripts\python -m pip install --upgrade pip
.\.venv\Scripts\python -m pip install pyinstaller -r requirements.txt
- name: Build app
run: |
.\.venv\Scripts\python -m PyInstaller $env:SPEC_PATH
Move-Item "$env:DIST_DIR\\tchMaterial-parser.exe" "$env:DIST_DIR\\tchMaterial-parser-windows-x64.exe"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: tchMaterial-parser-windows-x64.exe
path: ${{ env.DIST_DIR }}/tchMaterial-parser-windows-x64.exe
if-no-files-found: error
build-macos:
name: Build (macOS ARM64)
runs-on: macos-latest
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: pip
cache-dependency-path: requirements.txt
- name: Create virtual environment
run: python -m venv .venv
- name: Install dependencies
run: |
./.venv/bin/python -m pip install --upgrade pip
./.venv/bin/python -m pip install pyinstaller -r requirements.txt
- name: Build app
run: ./.venv/bin/python -m PyInstaller ${{ env.SPEC_PATH }}
- name: Ad-hoc sign app bundle
run: codesign --force --deep --sign - "${{ env.DIST_DIR }}/tchMaterial-parser.app"
- name: Create zip archive
run: |
cd "${{ env.DIST_DIR }}"
zip -r "tchMaterial-parser-mac-arm64.zip" "tchMaterial-parser.app"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: tchMaterial-parser-mac-arm64.zip
path: ${{ env.DIST_DIR }}/tchMaterial-parser-mac-arm64.zip
if-no-files-found: error
release:
name: Publish release
runs-on: ubuntu-latest
needs:
- build-linux
- build-windows
- build-macos
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: |
dist/tchMaterial-parser-windows-x64.exe
dist/tchMaterial-parser-linux-x64
dist/tchMaterial-parser-linux-arm64
dist/tchMaterial-parser-mac-arm64.zip
tag_name: ${{ inputs.tag || github.ref_name }}