Skip to content

Commit 8689fc9

Browse files
committed
chore(ci): add ClawHub publish workflow and script
- Add clawhub-publish.sh to publish all skills with version > 0.0.0 - Refactor workflow to use the shared script - Add WIP skills with version 0.0.0 (skipped by publish)
1 parent fe55d9e commit 8689fc9

2 files changed

Lines changed: 29 additions & 26 deletions

File tree

.github/workflows/publish-clawhub.yml

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,7 @@ jobs:
1717
with:
1818
node-version: '22'
1919

20-
- name: Login to ClawHub
21-
run: npx -y clawhub login --token "$CLAWHUB_TOKEN"
20+
- name: Publish all skills
21+
run: ./clawhub-publish.sh
2222
env:
2323
CLAWHUB_TOKEN: ${{ secrets.CLAWHUB_TOKEN }}
24-
25-
- name: Publish all skills
26-
run: |
27-
for skill_dir in skills/*/; do
28-
skill_name=$(basename "$skill_dir")
29-
skill_file="${skill_dir}SKILL.md"
30-
31-
if [ ! -f "$skill_file" ]; then
32-
echo "::warning::Skipping ${skill_name}: no SKILL.md found"
33-
continue
34-
fi
35-
36-
# Parse version from frontmatter
37-
version=$(awk '/^---$/{c++; next} c==1 && /^[[:space:]]*version:/{gsub(/[" ]/, "", $2); print $2; exit}' "$skill_file")
38-
39-
if [ -z "$version" ]; then
40-
echo "::warning::Skipping ${skill_name}: no version found in frontmatter"
41-
continue
42-
fi
43-
44-
echo "::group::Publishing ${skill_name} v${version}"
45-
npx -y clawhub publish "$PWD/${skill_dir}" --version "$version" || true
46-
echo "::endgroup::"
47-
done

clawhub-publish.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
if [ -n "${CLAWHUB_TOKEN:-}" ]; then
5+
npx -y clawhub login --token "$CLAWHUB_TOKEN"
6+
fi
7+
8+
for skill_dir in skills/*/; do
9+
skill_name=$(basename "$skill_dir")
10+
skill_file="${skill_dir}SKILL.md"
11+
12+
if [ ! -f "$skill_file" ]; then
13+
echo "Skipping ${skill_name}: no SKILL.md found"
14+
continue
15+
fi
16+
17+
# Parse version from frontmatter
18+
version=$(awk '/^---$/{c++; next} c==1 && /^[[:space:]]*version:/{gsub(/[" ]/, "", $2); print $2; exit}' "$skill_file")
19+
20+
if [ -z "$version" ] || [ "$version" = "0.0.0" ]; then
21+
echo "Skipping ${skill_name}: no version or version is 0.0.0"
22+
continue
23+
fi
24+
25+
echo "Publishing ${skill_name} v${version}"
26+
npx -y clawhub publish "$PWD/${skill_dir}" --version "$version" || true
27+
done

0 commit comments

Comments
 (0)