Toggle sticky routing #126
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: Build and Publish | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| release: | |
| description: "Release wheel to Production PyPI" | |
| required: false | |
| type: boolean | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: python | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| virtualenvs-in-project: true | |
| - name: Cache Poetry dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: python/.venv | |
| key: venv-${{ runner.os }}-${{ hashFiles('python/poetry.lock') }} | |
| restore-keys: venv-${{ runner.os }}- | |
| - name: Install library and dependencies | |
| run: make install | |
| - name: Build wheel | |
| run: poetry build | |
| - name: Upload wheel artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheel | |
| path: python/dist/ | |
| retention-days: 7 | |
| test: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: python | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| virtualenvs-in-project: true | |
| - name: Cache Poetry dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: python/.venv | |
| key: venv-${{ runner.os }}-${{ hashFiles('python/poetry.lock') }} | |
| restore-keys: venv-${{ runner.os }}- | |
| - name: Install library and dependencies | |
| run: make install | |
| - name: Lint and Test | |
| run: make ci | |
| publish-to-testpypi: | |
| runs-on: ubuntu-latest | |
| needs: [build, test] | |
| if: startsWith(github.ref, 'refs/tags/') | |
| environment: | |
| name: Test PyPI Publish | |
| url: https://test.pypi.org/project/model-hosting-container-standards/ | |
| permissions: | |
| id-token: write # IMPORTANT: mandatory for trusted publishing | |
| steps: | |
| - name: Download wheel artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wheel | |
| path: dist/ | |
| - name: Publish package distributions to TestPyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| publish-to-pypi: | |
| runs-on: ubuntu-latest | |
| needs: [build, test] | |
| if: ${{ startsWith(github.ref, 'refs/tags/') && inputs.release }} | |
| environment: | |
| name: PyPI Publish | |
| url: https://pypi.org/project/model-hosting-container-standards/ | |
| permissions: | |
| id-token: write # IMPORTANT: mandatory for trusted publishing | |
| steps: | |
| - name: Download wheel artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wheel | |
| path: dist/ | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 |