Generate Blender Python API Stubs #26
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: Generate Blender Python API Stubs | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Blender Tag to build' | |
required: true | |
python_version: | |
description: 'Python version to use' | |
required: true | |
default: '3.10.11' | |
workflow_call: | |
inputs: | |
tag: | |
description: 'Blender Tag to build' | |
required: true | |
type: string | |
python_version: | |
description: 'Python version to use' | |
required: true | |
default: '3.10.11' | |
type: string | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ github.event.inputs.python_version }} | |
- name: Extract Major and Minor Versions | |
id: version_extraction | |
run: | | |
python -c "import sys; version_tag = sys.argv[1].lstrip('v'); parts = version_tag.split('.'); major_version = '.'.join(parts[:2]); print(f'MAJOR_VERSION={major_version}')" "${{ github.event.inputs.tag }}" >> $GITHUB_ENV | |
python -c "import sys; version_tag = sys.argv[1].lstrip('v'); parts = version_tag.split('.'); minor_version = '.'.join(parts[:3]); print(f'MINOR_VERSION={minor_version}')" "${{ github.event.inputs.tag }}" >> $GITHUB_ENV | |
- name: Download Blender | |
run: | | |
wget "https://mirrors.ocf.berkeley.edu/blender/release/Blender$MAJOR_VERSION/blender-$MINOR_VERSION-linux-x64.tar.xz" | |
tar -xf "blender-$MINOR_VERSION-linux-x64.tar.xz" | |
mv "blender-$MINOR_VERSION-linux-x64" blender | |
shell: bash | |
- name: Checkout Blender repository | |
uses: actions/checkout@v2 | |
with: | |
repository: blender/blender | |
ref: ${{ github.event.inputs.tag }} # Checkout the tag specified in the workflow dispatch | |
submodules: 'recursive' # Recursively checkout submodules | |
path: blender-git | |
- name: Install Documentation Prerequisites | |
run: | | |
pip install bpystubgen | |
- name: Generate API Docs and Stubs | |
run: | | |
cd blender | |
./blender --background --factory-startup -noaudio --python ../blender-git/doc/python_api/sphinx_doc_gen.py -- --output=../python_api | |
python -m bpystubgen ../python_api/sphinx-in ../python_api/output | |
- name: Upload Stubs as Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: blender-python-api-stubs-${{ github.event.inputs.tag }} | |
path: | | |
python_api/output/** |