Skip to content

update publishing flow to use ni/python-actions #227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mshafer-NI
Copy link
Collaborator

Publishing is currently broken due to using an old PAT.

As part of switching to OIDC based publishing, we should bring in the update ni/python-actions templates

Copy link
Contributor

Thank you for contributing! 👋

@mshafer-NI
Copy link
Collaborator Author

@bkeryan, does this look right? (also, not sure how to test before merging...)

@bkeryan
Copy link
Contributor

bkeryan commented Jun 20, 2025

@bkeryan, does this look right? (also, not sure how to test before merging...)

After merging, it will show up in the UI, but, to test before merging:

  • temporarily add on: pull_request: to get GitHub to recognize the workflow
  • use gh workflow run --ref dev/update_release_process to run it

Copy link
Contributor

Choose a reason for hiding this comment

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


- name: Upload Python package
if: ${{ github.event.release.target_commitish == 'main' || startsWith(github.event.release.target_commitish, 'releases/')}}
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
Copy link
Contributor

Choose a reason for hiding this comment

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

Trusted publishing will not work without specifying the "pypi" environment and "id-token: write" permissions. See https://github.com/ni/nitypes-python/blob/main/.github/workflows/publish.yml#L66

Also, it is not secure to run poetry install, pytest, etc. in the "pypi" environment. You should split the workflow into multiple jobs:

  • build/test, upload artifact (default permissions)
  • download artifact, upload to pypi ("pypi" environment, "id-token: write" permissions)
  • update project version (default permissions)

@bkeryan
Copy link
Contributor

bkeryan commented Jun 20, 2025

@bkeryan, does this look right? (also, not sure how to test before merging...)

Also, you can test the publish workflow with TestPyPI by creating an account on test.pypi.org, editing the workflow to use testpypi by default, and publishing a release in your personal fork of the repo.

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.

2 participants