Skip to content

Latest commit

 

History

History
74 lines (51 loc) · 1.93 KB

README.md

File metadata and controls

74 lines (51 loc) · 1.93 KB

build-cog

This is a GitHub Action that builds Cog from source.

This is useful for testing unreleased versions of Cog, but you probably want 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:

- 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, 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

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