Skip to content

Commit

Permalink
Upload versioned tools to R2.
Browse files Browse the repository at this point in the history
  • Loading branch information
guillevalin committed Jan 23, 2025
1 parent eb2b8f0 commit 9740048
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
27 changes: 19 additions & 8 deletions .github/workflows/build_tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@ name: Build Shinkai Tools

on:
workflow_dispatch:
inputs:
node_version:
description: 'Shinkai Node version to use (e.g. 0.9.7)'
required: true
type: string
default: "0.9.7"
use_dev_prefix:
description: 'Use dev prefix for download URL (e.g. https://download.shinkai.com/dev-tools-0.9.7)'
required: true
type: boolean
default: true

jobs:
run_tests:
Expand Down Expand Up @@ -43,12 +54,12 @@ jobs:
SHINKAI_NODE_ADDR: "http://localhost:9550"
BEARER_TOKEN: ${{ secrets.API_V2_KEY }}
INITIALIZATION_DATA: ${{ secrets.INITIALIZATION_DATA }}
DOWNLOAD_PREFIX: "https://download.shinkai.com/tools"
DOWNLOAD_PREFIX: ${{ inputs.use_dev_prefix && 'https://download.shinkai.com/dev-tools' || 'https://download.shinkai.com/tools' }}
SKIP_IMPORT_FROM_DIRECTORY: true
SHINKAI_STORE_ADDR: "https://shinkai-store-302883622007.us-central1.run.app"
SHINKAI_STORE_TOKEN: ${{ secrets.SHINKAI_STORE_TOKEN }}
USE_DOCKER: true
SHINKAI_NODE_IMAGE: "dcsparkdevops/shinkai-node:latest"
SHINKAI_NODE_IMAGE: "dcsparkdevops/shinkai-node:${{ inputs.node_version }}"
run: |
./scripts/run_node.sh &
timeout 60 bash -c 'until curl -s --location "$SHINKAI_NODE_ADDR/v2/health_check" | jq -e ".status == \"ok\"" > /dev/null; do sleep 1; done'
Expand Down Expand Up @@ -98,12 +109,12 @@ jobs:
SHINKAI_NODE_ADDR: "http://localhost:9550"
BEARER_TOKEN: ${{ secrets.API_V2_KEY }}
INITIALIZATION_DATA: ${{ secrets.INITIALIZATION_DATA }}
DOWNLOAD_PREFIX: "https://download.shinkai.com/tools"
DOWNLOAD_PREFIX: ${{ inputs.use_dev_prefix && 'https://download.shinkai.com/dev-tools' || 'https://download.shinkai.com/tools' }}
SKIP_IMPORT_FROM_DIRECTORY: true
SHINKAI_STORE_ADDR: "https://shinkai-store-302883622007.us-central1.run.app"
SHINKAI_STORE_TOKEN: ${{ secrets.SHINKAI_STORE_TOKEN }}
USE_DOCKER: true
SHINKAI_NODE_IMAGE: "dcsparkdevops/shinkai-node:latest"
SHINKAI_NODE_IMAGE: "dcsparkdevops/shinkai-node:${{ inputs.node_version }}"
run: |
./scripts/run_node.sh &
timeout 60 bash -c 'until curl -s --location "$SHINKAI_NODE_ADDR/v2/health_check" | jq -e ".status == \"ok\"" > /dev/null; do sleep 1; done'
Expand All @@ -122,13 +133,13 @@ jobs:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_CACHE_INVALIDATION_TOKEN }}
DOWNLOAD_PREFIX: "https://download.shinkai.com/tools"
DOWNLOAD_PREFIX: ${{ inputs.use_dev_prefix && 'https://download.shinkai.com/dev-tools' || 'https://download.shinkai.com/tools' }}
run: |
export AWS_ACCESS_KEY_ID=${R2_ACCESS_KEY_ID}
export AWS_SECRET_ACCESS_KEY=${R2_SECRET_ACCESS_KEY}
export AWS_ENDPOINT_URL=https://${CLOUDFLARE_ACCOUNT_ID}.r2.cloudflarestorage.com
aws s3 sync ./packages/ s3://${R2_BUCKET}/tools/ --exclude "*" --include "*.zip" --include "directory.json" \
--endpoint-url https://${CLOUDFLARE_ACCOUNT_ID}.r2.cloudflarestorage.com \
--only-show-errors
UPLOAD_PATH=${{ inputs.use_dev_prefix && format('dev-tools-{0}', inputs.node_version) || format('tools-{0}', inputs.node_version) }}
aws s3 sync ./packages/ s3://${R2_BUCKET}/${UPLOAD_PATH}/ --exclude "*" --include "*.zip" --include "directory.json" \
--endpoint-url https://${CLOUDFLARE_ACCOUNT_ID}.r2.cloudflarestorage.com
deno run --allow-read --allow-env --allow-net scripts/invalidate_cache.ts
1 change: 0 additions & 1 deletion scripts/run_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export NO_SECRET_FILE="true"
export PROXY_IDENTITY="@@relayer_pub_01.arb-sep-shinkai"
export SHINKAI_TOOLS_RUNNER_DENO_BINARY_PATH="./shinkai-tools-runner-resources/deno"
export SHINKAI_TOOLS_RUNNER_UV_BINARY_PATH="./shinkai-tools-runner-resources/uv"
export SHINKAI_VERSION="0.9.5"
export SKIP_IMPORT_FROM_DIRECTORY="true"

# Add these lines to enable all log options
Expand Down

0 comments on commit 9740048

Please sign in to comment.