name: Publish package

on:
  release:
    types: [published]

jobs:
  deploy:
    name: Upload release to PyPI
    runs-on: ubuntu-latest
    environment:
      name: pypi
      url: https://pypi.org/p/tiler
    permissions:
      id-token: write
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false

      - uses: actions/setup-python@v5
        with:
          python-version: "3.x"

      - run: python -m pip install --user build

      - run: python -m build

      - uses: pypa/gh-action-pypi-publish@release/v1
        with:
          verbose: true
          skip-existing: true
