Skip to content

Commit

Permalink
support building cog from source
Browse files Browse the repository at this point in the history
fix assignment
  • Loading branch information
zeke committed Apr 19, 2024
1 parent 1d47a7c commit de6bc57
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,21 @@ Defaults to `v0.8.6`.
cog-version: "v0.9.5"
```

#### `cog-commitish`

The commitish (branch, tag, or commit) of Cog to build from source using [replicate/build-cog](https://github.com/replicate/build-cog).

If this is set, the `cog-version` input is ignored.

Uses

```yml
- name: Setup Cog
uses: replicate/setup-cog@v1
with:
cog-commitish: "3cf1e44" # can be a commit SHA, branch name, or tag name
```

#### `token`

Your Replicate API token. If set, the Action will automatically authenticate to Replicate using `cog login`. To use this feature, create a token at [replicate.com/account/api-tokens](https://replicate.com/account/api-tokens), copy it, then paste it into a [repository secret](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions) named `REPLICATE_API_TOKEN` in your GitHub repo's settings.
Expand Down
14 changes: 12 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ inputs:
description: "The version of Cog to install"
required: false
default: "v0.8.6"
cog-commitish:
description: "The commitish (branch, tag, or commit) of Cog to build from source. If this is set, the `cog-version` input is ignored."
required: false
default: ''
install-cuda:
description: "Install NVIDIA CUDA Toolkit to build GPU-bound containers."
required: false
default: 'true'


runs:
using: "composite"
steps:
Expand All @@ -30,7 +33,14 @@ runs:
if: ${{ inputs.install-cuda == 'true' }}
uses: Jimver/cuda-toolkit@dc0ca7bb29c5a92f7a963d3d5c93f8d59765136a # v0.2.14

- name: Setup Cog
- name: Build Cog from source
if: ${{ inputs.cog-commitish != '' }}
uses: replicate/build-cog@v1
with:
commitish: ${{ inputs.cog-commitish }}

- name: Download an existing Cog version
if: ${{ inputs.cog-commitish == '' }}
shell: bash
run: |
sudo curl -o /usr/local/bin/cog -L https://github.com/replicate/cog/releases/download/${{ inputs.cog-version }}/cog_Linux_x86_64
Expand Down

0 comments on commit de6bc57

Please sign in to comment.