Skip to content

cog safe push ci

cog safe push ci #11

Workflow file for this run

name: Push Models
on:
workflow_dispatch:
branches: [main]
inputs:
no_push:
description: 'Test only, without pushing to prod'
type: boolean
default: true
# Adding a second workflow trigger with a different name
workflow_dispatch:
workflows: ["Push LORA Models"]
inputs:
branch:
description: 'Branch to run on'
type: string
default: 'main'
required: true
no_push_lora:
description: 'Test only, without pushing LORA models to prod'
type: boolean
default: true
jobs:
cog-safe-push:
runs-on: ubuntu-latest-4-cores
if: github.event.workflow == null # Only run for the original workflow
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- 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: cog login
run: |
echo ${{ secrets.COG_TOKEN }} | cog login --token-stdin
- name: Install cog-safe-push
run: |
pip install git+https://github.com/replicate/cog-safe-push.git
- name: Select schnell
run: |
./script/select.sh schnell
- name: Run cog-safe-push on flux-schnell and optionally push to production
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
REPLICATE_API_TOKEN: ${{ secrets.REPLICATE_API_TOKEN }}
run: |
cog-safe-push -vv ${{ github.event.inputs.no_push == 'true' && '--no-push' || '' }} --config=cog-safe-push-schnell.yaml
- name: Select dev
run: |
./script/select.sh dev
- name: Run cog-safe-push on flux-dev and optionally push to production
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
REPLICATE_API_TOKEN: ${{ secrets.REPLICATE_API_TOKEN }}
run: |
cog-safe-push -vv ${{ github.event.inputs.no_push == 'true' && '--no-push' || '' }} --config=cog-safe-push-dev.yaml
cog-safe-push-lora:
runs-on: ubuntu-latest-4-cores
if: github.event.workflow == 'Push LORA Models' # Only run for the LORA workflow
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- 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: cog login
run: |
echo ${{ secrets.COG_TOKEN }} | cog login --token-stdin
- name: Install cog-safe-push
run: |
pip install git+https://github.com/replicate/cog-safe-push.git
- name: Select dev-lora
run: |
./script/select.sh dev-lora
- name: Run cog-safe-push on flux-dev-lora
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
REPLICATE_API_TOKEN: ${{ secrets.REPLICATE_API_TOKEN }}
run: |
cog-safe-push -vv ${{ github.event.inputs.no_push_lora == 'true' && '--no-push' || '' }} --config=cog-safe-push-dev-lora.yaml
- name: Select schnell-lora
run: |
./script/select.sh schnell-lora
- name: Run cog-safe-push on flux-schnell-lora
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
REPLICATE_API_TOKEN: ${{ secrets.REPLICATE_API_TOKEN }}
run: |
cog-safe-push -vv ${{ github.event.inputs.no_push_lora == 'true' && '--no-push' || '' }} --config=cog-safe-push-schnell-lora.yaml