yay uv #1
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: Deploy Word Manifold | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install poetry | |
| poetry install | |
| - name: Run tests | |
| run: poetry run pytest | |
| - name: Run linting | |
| run: | | |
| poetry run black --check . | |
| poetry run flake8 . | |
| poetry run mypy . | |
| deploy: | |
| needs: test | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Cog | |
| run: | | |
| sudo curl -o /usr/local/bin/cog -L https://github.com/replicate/cog/releases/latest/download/cog_`uname -s`_`uname -m` | |
| sudo chmod +x /usr/local/bin/cog | |
| - name: Build and push to Replicate | |
| env: | |
| REPLICATE_API_TOKEN: ${{ secrets.REPLICATE_API_TOKEN }} | |
| run: | | |
| cog login --token $REPLICATE_API_TOKEN | |
| cog push r8.im/${{ github.repository }} | |
| - name: Create Release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| cog.yaml | |
| predict.py | |
| body: | | |
| ## Replicate Model | |
| Access the model at: https://replicate.com/${{ github.repository }} | |
| ### Example Usage | |
| ```python | |
| import replicate | |
| model = replicate.models.get("${{ github.repository }}") | |
| prediction = model.predict(task="embed", text="wisdom") | |
| ``` |