name: "[CD] Upload to pypi"

on:
  release:
    types: [published]

permissions:
  contents: read
  id-token: write

jobs:
  deploy:
    runs-on: ubuntu-latest
    if: github.repository == 'aws-cloudformation/cfn-lint'
    steps:
      - uses: actions/checkout@v6
      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version: "3.13"
      - name: Install dependencies
        run: |
          pip install --upgrade pip
          pip install --upgrade setuptools build wheel twine
      - name: Build and publish
        run: |
          python -m build
      - name: Publish to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1
