Skip to content

Publish API clients #62

Publish API clients

Publish API clients #62

name: Publish API clients
on:
workflow_run:
workflows: ["Deploy"]
types:
- completed
branches:
- main
jobs:
publish:
name: Publish API clients
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Generate API clients
run: |
./scripts/generate-clients.sh
- name: Build full API client
run: |
cd projects/policyengine-api-full/artifacts/clients/python
# Update version
DATE=$(date +%Y%m%d)
RUN_NUMBER="${{ github.run_number }}"
NEW_VERSION="0.${DATE}.${RUN_NUMBER}"
sed -i "s/^version = .*/version = \"${NEW_VERSION}\"/" pyproject.toml
uv build
- name: Build simulation API client
run: |
cd projects/policyengine-api-simulation/artifacts/clients/python
# Update version
DATE=$(date +%Y%m%d)
RUN_NUMBER="${{ github.run_number }}"
NEW_VERSION="0.${DATE}.${RUN_NUMBER}"
sed -i "s/^version = .*/version = \"${NEW_VERSION}\"/" pyproject.toml
uv build
- name: Publish full API client to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI }}
packages-dir: projects/policyengine-api-full/artifacts/clients/python/dist/
- name: Publish simulation API client to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI }}
packages-dir: projects/policyengine-api-simulation/artifacts/clients/python/dist/