name: Publish to PyPI

on:
  push:
    tags: ["v*"]

jobs:
  pypi:
    runs-on: ubuntu-latest
    environment: pypi
    permissions:
      id-token: write  # for trusted publishing
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with: { python-version: "3.11" }
      - run: pip install build
      - run: python -m build packages/core
      - run: python -m build apps/cli
      - name: Publish verify-core
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          packages-dir: packages/core/dist
      - name: Publish 15code-verify (CLI)
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          packages-dir: apps/cli/dist
