Skip to content

Merge pull request #40 from dcSpark/feature/memory #70

Merge pull request #40 from dcSpark/feature/memory

Merge pull request #40 from dcSpark/feature/memory #70

Workflow file for this run

name: Build Shinkai Tools
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build_tools:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- name: Install b3sum
run: cargo install b3sum
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y curl jq coreutils
- name: Make script executable
run: |
chmod +x ./.github/build_tool.sh
chmod +x ./.github/run_node.sh
- name: Run node in background
id: run_node
env:
INITIAL_AGENT_NAMES: ${{ secrets.INITIAL_AGENT_NAMES }}
INITIAL_AGENT_URLS: ${{ secrets.INITIAL_AGENT_URLS }}
INITIAL_AGENT_MODELS: ${{ secrets.INITIAL_AGENT_MODELS }}
INITIAL_AGENT_API_KEYS: ${{ secrets.INITIAL_AGENT_API_KEYS }}
API_V2_KEY: ${{ secrets.API_V2_KEY }}
EMBEDDINGS_SERVER_URL: ${{ secrets.EMBEDDINGS_SERVER_URL }}
SHINKAI_NODE_ADDR: "http://localhost:9550"
BEARER_TOKEN: ${{ secrets.API_V2_KEY }}
INITIALIZATION_DATA: ${{ secrets.INITIALIZATION_DATA }}
DOWNLOAD_PREFIX: "https://download.shinkai.com/tools"
SKIP_IMPORT_FROM_DIRECTORY: true
run: |
./.github/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'
curl --location "$SHINKAI_NODE_ADDR/v2/initial_registration" \
--header 'Content-Type: application/json; charset=utf-8' \
--data "$INITIALIZATION_DATA"
./.github/build_tool.sh
if jq -e '.[] | select(.description == "")' packages/directory.json > /dev/null; then
echo "Error: Empty descriptions found in packages/directory.json"
exit 1
fi
- name: Upload to Cloudflare R2
if: steps.run_node.outcome == 'success'
env:
R2_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
R2_BUCKET: ${{ secrets.R2_BUCKET }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
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/ \
--endpoint-url https://${CLOUDFLARE_ACCOUNT_ID}.r2.cloudflarestorage.com \
--only-show-errors