forked from samber/cc-skills-golang
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclawhub-publish.sh
More file actions
executable file
·36 lines (28 loc) · 950 Bytes
/
clawhub-publish.sh
File metadata and controls
executable file
·36 lines (28 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
set -euo pipefail
if [ -n "${CLAWHUB_TOKEN:-}" ]; then
# executed from in ci
npx -y clawhub login --token "$CLAWHUB_TOKEN"
fi
for skill_dir in skills/*/; do
skill_name=$(basename "$skill_dir")
skill_file="${skill_dir}SKILL.md"
if [ ! -f "$skill_file" ]; then
echo "Skipping ${skill_name}: no SKILL.md found"
continue
fi
# Parse version from frontmatter
version=$(awk '/^---$/{c++; next} c==1 && /^[[:space:]]*version:/{gsub(/[" ]/, "", $2); print $2; exit}' "$skill_file")
if [ -z "$version" ] || [ "$version" = "0.0.0" ]; then
echo "Skipping ${skill_name}: no version or version is 0.0.0"
continue
fi
echo "Publishing ${skill_name} v${version}"
npx -y clawhub publish "$PWD/${skill_dir}" --version "$version" || true
if [ -n "${CLAWHUB_TOKEN:-}" ]; then
# executed from in ci
continue
fi
# rate limits: 5 skills per hour / 20 skills per day
sleep 3600
done