Skip to content

Build and Publish

Build and Publish #2

name: Build and Publish
on:
push:
branches: [ "main" ]
workflow_dispatch:
release:
# Trigger on GitHub release creation
types: [created]
jobs:
build-and-publish:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.11"]
steps:
- name: Checkout repo with submodules
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
persist-credentials: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Sync and update FracturedJson submodule
run: |
set -euo pipefail
git submodule sync --recursive
git submodule update --init --recursive
pushd FracturedJson
git fetch --no-tags origin main
git checkout -B main origin/main
git reset --hard origin/main
popd
- name: Install .NET 8 (Windows only)
if: matrix.os == 'windows-latest'
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --locked --all-extras --dev
- name: Build FracturedJson binaries
run: uv run python3 src/build/build_binaries.py
- name: Build wheel
run: |
python -m pip install --upgrade build twine
python -m build --wheel
- name: Publish to PyPI
if: github.event_name == 'release' || github.ref_type == 'tag'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: python -m twine upload dist/*