vxkyyy commited on
Commit
db4ae31
·
1 Parent(s): 3cdde15

fix: sync LLM API secrets to HF Space on every deploy

Browse files
Files changed (1) hide show
  1. .github/workflows/deploy.yml +40 -0
.github/workflows/deploy.yml CHANGED
@@ -31,3 +31,43 @@ jobs:
31
  fi
32
  git remote add hf "https://hf_user:${HF_TOKEN}@huggingface.co/spaces/vxkyyy/AgentIC"
33
  git push hf main --force
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  fi
32
  git remote add hf "https://hf_user:${HF_TOKEN}@huggingface.co/spaces/vxkyyy/AgentIC"
33
  git push hf main --force
34
+
35
+ - name: Sync LLM secrets to HuggingFace Space
36
+ env:
37
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
38
+ NVIDIA_API_KEY: ${{ secrets.NVIDIA_API_KEY }}
39
+ NVIDIA_MODEL: ${{ secrets.NVIDIA_MODEL }}
40
+ NVIDIA_BASE_URL: ${{ secrets.NVIDIA_BASE_URL }}
41
+ LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
42
+ LLM_MODEL: ${{ secrets.LLM_MODEL }}
43
+ LLM_BASE_URL: ${{ secrets.LLM_BASE_URL }}
44
+ GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
45
+ run: |
46
+ HF_SPACE="vxkyyy/AgentIC"
47
+ API="https://huggingface.co/api/spaces/${HF_SPACE}/secrets"
48
+
49
+ set_secret() {
50
+ local key="$1"
51
+ local value="$2"
52
+ if [ -z "$value" ]; then
53
+ echo "⏭ Skipping ${key} (not set in GitHub secrets)"
54
+ return
55
+ fi
56
+ HTTP=$(curl -s -o /dev/null -w "%{http_code}" -X PUT "$API" \
57
+ -H "Authorization: Bearer ${HF_TOKEN}" \
58
+ -H "Content-Type: application/json" \
59
+ -d "[{\"key\":\"${key}\",\"value\":\"${value}\"}]")
60
+ if [ "$HTTP" = "200" ] || [ "$HTTP" = "201" ]; then
61
+ echo "✓ ${key} synced to HF Space"
62
+ else
63
+ echo "::warning::Failed to sync ${key} (HTTP ${HTTP})"
64
+ fi
65
+ }
66
+
67
+ set_secret "NVIDIA_API_KEY" "$NVIDIA_API_KEY"
68
+ set_secret "NVIDIA_MODEL" "$NVIDIA_MODEL"
69
+ set_secret "NVIDIA_BASE_URL" "$NVIDIA_BASE_URL"
70
+ set_secret "LLM_API_KEY" "$LLM_API_KEY"
71
+ set_secret "LLM_MODEL" "$LLM_MODEL"
72
+ set_secret "LLM_BASE_URL" "$LLM_BASE_URL"
73
+ set_secret "GROQ_API_KEY" "$GROQ_API_KEY"