Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ on:
- main
pull_request:
workflow_dispatch:
inputs:
publish_pypi: # only from main branch it is possible to publish to pypi
Copy link
Member

Choose a reason for hiding this comment

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

Why not allow tags?

Copy link
Member Author

Choose a reason for hiding this comment

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

what workflow to you suggest? uploading tags? or tagging directly via github ui?

description: 'Publish to pypi'
required: true
type: choice
options:
- 'yes'
- 'no'
default: 'no'

jobs:
build_wheels:
Expand Down Expand Up @@ -87,15 +96,15 @@ jobs:
permissions:
id-token: write

if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
if: (github.event.inputs.publish_pypi == 'yes') && (github.ref == 'refs/heads/main') && (github.repository_owner == 'onnx') && (github.event_name == 'workflow_dispatch')
needs: [build_wheels, build_sdist]
steps:
- uses: actions/download-artifact@v6
with:
name: artifact
path: dist

- name: Publish distribution 📦 to PyPI
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down