-
Notifications
You must be signed in to change notification settings - Fork 0
189 lines (165 loc) · 8.21 KB
/
Copy pathrelease.yml
File metadata and controls
189 lines (165 loc) · 8.21 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: Release
on:
push:
tags:
# Trigger on any version tag: v7.1.0, v7.1.1, v7.2.0, etc.
# Excludes 'latest' (mutable tag, pushed manually or by another workflow).
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-*' # pre-releases like v7.1.0-rc.1
permissions:
contents: write # needed to create GitHub release + move 'latest' tag
jobs:
build-and-release:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout tag
uses: actions/checkout@v4
with:
fetch-depth: 1 # shallow clone, we only need the tagged commit
- name: Verify skill directory exists
run: |
if [ ! -d skill/stellar-trails ]; then
echo "::error::skill/stellar-trails/ directory not found in tag ${{ github.ref_name }}"
exit 1
fi
if [ ! -f skill/stellar-trails/SKILL.md ]; then
echo "::error::SKILL.md not found in skill/stellar-trails/"
exit 1
fi
echo "✓ Skill directory verified"
- name: Extract version from SKILL.md
id: version
run: |
# Extract version from SKILL.md metadata: "- **version**: 7.1.1"
# Line format: "- **version**: 7.1.1" (markdown bullet list with bold key)
VERSION=$(grep -oP '^\- \*\*version\*\*:\s*\K[0-9]+\.[0-9]+\.[0-9]+' skill/stellar-trails/SKILL.md | head -1)
if [ -z "$VERSION" ]; then
echo "::error::Could not extract version from SKILL.md"
echo "::error::Expected line format: '- **version**: X.Y.Z'"
echo "::error::Actual SKILL.md content (first 15 lines):"
head -15 skill/stellar-trails/SKILL.md | sed 's/^/::error:: /'
exit 1
fi
TAG_NAME="${{ github.ref_name }}"
# Strip leading 'v' from tag for comparison
TAG_VERSION="${TAG_NAME#v}"
if [ "$VERSION" != "$TAG_VERSION" ]; then
echo "::error::Version mismatch: SKILL.md says $VERSION, tag says $TAG_VERSION"
exit 1
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=${TAG_NAME}" >> $GITHUB_OUTPUT
echo "✓ Version verified: $VERSION (tag $TAG_NAME)"
- name: Build skill zip
id: build
run: |
# Build zip with stellar-trails/ as top-level dir inside zip
# (ZAI service expects /home/z/my-project/skills/stellar-trails/ after extraction)
cd skill
zip -qr ../stellar-trails.zip stellar-trails/
cd ..
ZIP_FILE="stellar-trails.zip"
ZIP_SHA=$(sha256sum "$ZIP_FILE" | awk '{print $1}')
ZIP_SIZE=$(stat -c%s "$ZIP_FILE")
echo "zip_file=$ZIP_FILE" >> $GITHUB_OUTPUT
echo "zip_sha=$ZIP_SHA" >> $GITHUB_OUTPUT
echo "zip_size=$ZIP_SIZE" >> $GITHUB_OUTPUT
echo "✓ Built $ZIP_FILE ($ZIP_SIZE bytes, SHA-256: ${ZIP_SHA:0:12}...)"
- name: Generate SHA256 checksum file
run: |
sha256sum stellar-trails.zip > stellar-trails.zip.sha256
echo "✓ Checksum file generated"
cat stellar-trails.zip.sha256
- name: Verify zip contents
run: |
echo "=== Zip contents ==="
unzip -l stellar-trails.zip
echo
echo "=== SKILL.md version in zip ==="
unzip -p stellar-trails.zip stellar-trails/SKILL.md | grep -E "^- \*\*version\*\*:|STELLAR TRAILS ·" | head -3
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: stellar-trails v${{ steps.version.outputs.version }}
body: |
# stellar-trails v${{ steps.version.outputs.version }}
## Install on ZAI platform
```bash
# Download asset dari release ini (atau pakai gh CLI)
gh release download v${{ steps.version.outputs.version }} \
--repo hoshiyomiX/stellar-trails \
--pattern 'stellar-trails.zip' \
--dir /tmp/
# Upload ke ZAI persistent storage
cp /tmp/stellar-trails.zip /home/user_skills/stellar-trails.zip
touch /home/user_skills/.stellar-trails.usermark
```
Next ZAI session akan auto-extract skill ke `/home/z/my-project/skills/stellar-trails/`.
## Install standalone (non-ZAI)
See [README.md](https://github.com/hoshiyomiX/stellar-trails/blob/${{ steps.version.outputs.tag }}/README.md#path-b--standalone-non-zai-optional-bootsh) for Path B instructions.
## Checksum
- File: `stellar-trails.zip`
- Size: ${{ steps.build.outputs.zip_size }} bytes
- SHA-256: `${{ steps.build.outputs.zip_sha }}`
Verify after download:
```bash
sha256sum stellar-trails.zip
# Should match: ${{ steps.build.outputs.zip_sha }}
```
## Changelog
See [CHANGELOG.md](https://github.com/hoshiyomiX/stellar-trails/blob/${{ steps.version.outputs.tag }}/skill/stellar-trails/CHANGELOG.md) for full history.
files: |
stellar-trails.zip
stellar-trails.zip.sha256
draft: false
prerelease: ${{ contains(steps.version.outputs.version, '-') }}
- name: Update 'latest' tag (mutable, points to newest release)
if: ${{ !contains(steps.version.outputs.version, '-') }}
run: |
# Move 'latest' tag to this commit. Force-push because 'latest' is mutable.
# Only do this for stable releases (no pre-release suffix).
git tag -f latest ${{ github.sha }}
git push -f origin refs/tags/latest
echo "✓ 'latest' tag moved to ${{ steps.version.outputs.tag }} (${{ github.sha }})"
- name: Publish to ClawHub
if: ${{ !contains(steps.version.outputs.version, '-') }}
env:
CLAWHUB_TOKEN: ${{ secrets.CLAWHUB_TOKEN }}
run: |
if [ -z "$CLAWHUB_TOKEN" ]; then
echo "⚠️ CLAWHUB_TOKEN secret not set — skipping ClawHub publish"
echo "Set it in: Settings → Secrets and variables → Actions → New repository secret"
echo "Name: CLAWHUB_TOKEN, Value: your ClawHub API token (clh_...)"
exit 0
fi
npm install -g clawhub 2>/dev/null || true
clawhub login --token "$CLAWHUB_TOKEN"
clawhub skill publish "$GITHUB_WORKSPACE/skill/stellar-trails" \
--slug stellar-trails \
--version ${{ steps.version.outputs.version }} \
--source-repo ${{ github.server_url }}/${{ github.repository }} \
--source-commit ${{ github.sha }} \
--changelog "v${{ steps.version.outputs.version }} — see CHANGELOG.md"
echo "✓ Published stellar-trails@${{ steps.version.outputs.version }} to ClawHub"
- name: Summary
run: |
echo "## Release Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Item | Value |" >> $GITHUB_STEP_SUMMARY
echo "|------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| Version | v${{ steps.version.outputs.version }} |" >> $GITHUB_STEP_SUMMARY
echo "| Tag | ${{ steps.version.outputs.tag }} |" >> $GITHUB_STEP_SUMMARY
echo "| Zip file | stellar-trails.zip |" >> $GITHUB_STEP_SUMMARY
echo "| Size | ${{ steps.build.outputs.zip_size }} bytes |" >> $GITHUB_STEP_SUMMARY
echo "| SHA-256 | \`${{ steps.build.outputs.zip_sha }}\` |" >> $GITHUB_STEP_SUMMARY
echo "| Release URL | ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ steps.version.outputs.tag }} |" >> $GITHUB_STEP_SUMMARY
echo "| ClawHub | https://clawhub.ai/hoshiyomix/stellar-trails |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Install on ZAI" >> $GITHUB_STEP_SUMMARY
echo '```bash' >> $GITHUB_STEP_SUMMARY
echo "clawhub install stellar-trails" >> $GITHUB_STEP_SUMMARY
echo "cp /tmp/stellar-trails.zip /home/user_skills/stellar-trails.zip" >> $GITHUB_STEP_SUMMARY
echo "touch /home/user_skills/.stellar-trails.usermark" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY