Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Inference Experimental Wheels to PyPi | |
| on: | |
| release: | |
| types: [created] | |
| workflow_dispatch: | |
| inputs: | |
| publish: | |
| description: "Actually publish the package to PyPI" | |
| required: false | |
| default: false | |
| type: boolean | |
| pre_release: | |
| description: "Mark as pre-release" | |
| required: false | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| build: | |
| name: ${{ github.event_name == 'release' && 'Release publish' || (github.event.inputs.publish == 'true' && (github.event.inputs.pre_release == 'true' && 'Manual publish (pre-release)' || 'Manual publish (rejected - non-prerelease)') || 'Manual build only') }} | |
| runs-on: | |
| labels: depot-ubuntu-22.04-small | |
| group: public-depot | |
| timeout-minutes: 20 | |
| strategy: | |
| matrix: | |
| python-version: ["3.12"] | |
| steps: | |
| - name: 🛎️ Checkout | |
| uses: actions/checkout@v4 | |
| - name: 🐍 Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| check-latest: true | |
| - name: 📦 Install dependencies | |
| working-directory: inference_models | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install uv | |
| - name: 🏷️ Modify version for pre-release | |
| if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.pre_release == 'true' }} | |
| working-directory: inference_models | |
| run: | | |
| CURRENT_VERSION=$(grep -m 1 '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/') | |
| echo "Current version: $CURRENT_VERSION" | |
| if [[ $CURRENT_VERSION =~ (a|b|rc)[0-9]+$ ]]; then | |
| echo "Version already has pre-release suffix, keeping as is" | |
| else | |
| TIMESTAMP=$(date +%Y%m%d%H%M%S) | |
| NEW_VERSION="${CURRENT_VERSION}rc${TIMESTAMP}" | |
| echo "New pre-release version: $NEW_VERSION" | |
| sed -i.bak "s/^version = \"${CURRENT_VERSION}\"/version = \"${NEW_VERSION}\"/" pyproject.toml | |
| rm pyproject.toml.bak | |
| fi | |
| - name: 🔨 Build package | |
| working-directory: inference_models | |
| run: | | |
| python -m uv build | |
| - name: 🚀 Publish to PyPI | |
| if: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true') }} | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: inference_models/dist/ | |
| skip-existing: true |