name: Build and Publish Package on: pull_request: branches: - main types: - closed jobs: publish-package: if: ${{ github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v') }} runs-on: ubuntu-latest environment: publish permissions: id-token: write steps: - name: Check out repo main branch uses: actions/checkout@v5 with: ref: main - name: Set up Python 3.10 uses: actions/setup-python@v6 with: python-version-file: ".python-version" - name: Install uv uses: astral-sh/setup-uv@v6 with: version: "0.9.3" - name: Get project Version id: project_version run: echo "project_version=$(uv version --short)" >> $GITHUB_OUTPUT - name: Build package run: uv build --all-packages - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@release/v1 - name: Create a Github Release uses: softprops/action-gh-release@v2 with: tag_name: v${{ steps.project_version.outputs.project_version }} target_commitish: main token: ${{ secrets.GH_RELEASE_TOKEN }} body_path: CHANGELOG.md files: | LICENSE dist/**.whl dist/**.tar.gz