name: Upload Python Package # The tag is now triggered by the Github App: CommitizenBot on: push: tags: - "v*" # Manual trigger for republishing a specific tag if the original push-on-tag # run failed and is now too old to be re-run via the GitHub UI (#1790). # ``ref`` should be a tag name like ``v4.11.1``. workflow_dispatch: inputs: ref: description: "Tag to republish (e.g., v4.11.1)" required: true type: string jobs: deploy: if: ${{ github.repository == 'commitizen-tools/commitizen' }} runs-on: ubuntu-latest permissions: id-token: write contents: read steps: - name: Validate dispatch ref is a tag if: github.event_name == 'workflow_dispatch' env: TAG: ${{ github.event.inputs.ref }} run: | if ! git ls-remote --tags "https://github.com/${GITHUB_REPOSITORY}" "refs/tags/${TAG}" | grep -q .; then echo "::error::Dispatch ref '${TAG}' is not an existing tag" exit 1 fi - uses: actions/checkout@v7 with: fetch-depth: 0 ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', github.event.inputs.ref) || github.ref }} - name: Set up Python uses: astral-sh/setup-uv@v7 - name: Build run: uv build - name: Publish package to PyPI uses: pypa/gh-action-pypi-publish@release/v1