name: Release
on:
  push:
    branches:
      - main
jobs:
  pypi-publish:
    name: upload release to PyPI
    runs-on: ubuntu-latest
    environment:
      name: PyPI
      url: https://pypi.org/project/mlflow-migration/
    permissions: write-all
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v5
        with:
          python-version: 3.12
      - name: Install build dependencies
        run: |
          python -m pip install --upgrade pip
          pip install build
      - name: Make release
        id: release
        uses: cycjimmy/semantic-release-action@v4
        with:
          extra_plugins: |
            - @semantic-release/exec
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      - name: Publish package distributions to PyPI
        if: steps.release.outputs.new_release_published == 'true'
        uses: pypa/gh-action-pypi-publish@release/v1
