Skip to content

Conversation

Pouyanpi
Copy link
Collaborator

Add publish-pypi-approval.yml workflow that triggers after successful builds on version tags. Includes manual approval gate, version validation, PyPI publishing via trusted publishing, draft GitHub release creation, and installation verification.

Add publish-pypi-approval.yml workflow that triggers after successful
builds on version tags. Includes manual approval gate, version
validation, PyPI publishing via trusted publishing, draft GitHub release
creation, and installation verification.
@Pouyanpi Pouyanpi requested a review from Copilot September 30, 2025 19:26
@Pouyanpi Pouyanpi self-assigned this Sep 30, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a PyPI publishing workflow that triggers automatically after successful builds on version tags, with manual approval gates for production deployment. The workflow validates versions, publishes to PyPI using trusted publishing, creates draft GitHub releases, and verifies successful publication.

Key changes:

  • Automated PyPI publishing triggered by successful build workflows on version tags
  • Manual approval environment gate for production deployments
  • Post-publish verification testing across Python versions

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Pouyanpi Pouyanpi marked this pull request as draft September 30, 2025 19:29
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Collaborator

@tgasser-nv tgasser-nv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, left some comments below. How did you test this? Can you add the commands and output to the PR description.

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.13"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need all the versions in-between as well (3.11, 3.12)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really, even one is ok. I am thinking maybe we are better of dropping this last test entirely.


- name: Wait for PyPI to process package
run: |
echo "Waiting 120 seconds for PyPI to process the package..."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have any data on how long this normally takes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my limited observation, PyPI seems to process in under 10s, but we use a longer wait to be safe. We can adjust later if needed.

pip install --upgrade pip
pip install "nemoguardrails==${{ steps.version.outputs.version }}" --no-cache-dir

- name: Start server in the background
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of this? Is it to validate the artifact we're about to upload to PyPI ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It tests the published version (what was just published). we actually do similar test in test-and-build-wheel workflow, I expect it to pass most of the time. We might remove it later.

@Pouyanpi
Copy link
Collaborator Author

Pouyanpi commented Oct 2, 2025

@tgasser-nv we will see how it works in prod. Testing it is not possible. We could try test.pypi.org but to simulate the complete scenario wouldn't be worth the effort. we can merge and see how it works in action. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants