https://github.com/replicate/build-cog
An experimental GitHub Actions workflow to build Cog from source
https://github.com/replicate/build-cog
Last synced: 3 months ago
JSON representation
An experimental GitHub Actions workflow to build Cog from source
- Host: GitHub
- URL: https://github.com/replicate/build-cog
- Owner: replicate
- License: apache-2.0
- Created: 2024-04-19T17:10:47.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-22T22:28:26.000Z (about 2 years ago)
- Last Synced: 2025-12-17T18:38:22.459Z (5 months ago)
- Size: 11.7 KB
- Stars: 0
- Watchers: 10
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# build-cog
This is a GitHub Action that builds [Cog](https://cog.run) from source.
This is useful for testing unreleased versions of Cog, but **you probably want [replicate/setup-cog](https://github.com/replicate/setup-cog) instead**, which handles more setup like installing Docker buildx, installing NVIDIA's CUDA drivers, installing a release of Cog, logging in to Replicate, etc.
## Usage
Add a step to your workflow that uses this action:
```yml
- name: Build Cog from source
uses: replicate/build-cog@v1
with:
commitish: "3cf1e44" # can be a SHA, branch name, or tag name
```
This will clone the [Cog repository](https://github.com/replicate/cog), checkout the specified commitish, compile the `cog` binary, and make it available in the `PATH`.
Now you can run the `cog` CLI in subsequent steps to `cog run`, `cog build`, `cog push`, etc.
## Inputs
This following input can be specified using the `with` keyword:
### `commitish`
In Git, a commitish is a reference that can be resolved to a commit, such as a commit hash, branch name, or tag name.
All of the following are examples of valid commitishs:
- `3cf1e44`: A commit hash prefix
- `3cf1e448ca54088d797bc774ccc4b7a9f075aae0`: A full commit hash
- `main`: A branch name
- `v0.8.6`: A tag name
This is optional. It defaults to `main`.
## Example workflow
```yml
name: Push model to Replicate
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@v1.3.1
with:
tool-cache: false
docker-images: false
- name: Checkout my model code
uses: actions/checkout@v4
- name: Build cog binary from source
uses: replicate/build-cog@v1
with:
commitish: main
- name: Build the model
run: cog build
- name: Push to Replicate
run: cog push r8.im/my-username/my-model
```