Skip to content

Commit 3900e54

Browse files
committed
ci add auto publish to ClawHub on version tags
1 parent b4d3fb4 commit 3900e54

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish to ClawHub
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
env:
15+
CLAWHUB_SLUG: bilibili-cli
16+
CLAWHUB_NAME: bilibili-cli
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: "20"
24+
25+
- name: Install ClawHub CLI
26+
run: npm install -g clawhub@0.7.0
27+
28+
- name: Publish to ClawHub
29+
env:
30+
CLAWHUB_TOKEN: ${{ secrets.CLAWHUB_TOKEN }}
31+
run: |
32+
if [ -z "${CLAWHUB_TOKEN:-}" ]; then
33+
echo "Missing required secret: CLAWHUB_TOKEN"
34+
exit 1
35+
fi
36+
37+
VERSION="${GITHUB_REF_NAME#v}"
38+
echo "Publishing ${CLAWHUB_SLUG}@${VERSION}"
39+
40+
if clawhub --no-input inspect "${CLAWHUB_SLUG}" --version "${VERSION}" >/dev/null 2>&1; then
41+
echo "Version ${VERSION} already exists on ClawHub, skipping publish."
42+
exit 0
43+
fi
44+
45+
clawhub --no-input login --token "${CLAWHUB_TOKEN}" --no-browser
46+
clawhub --no-input publish . \
47+
--slug "${CLAWHUB_SLUG}" \
48+
--name "${CLAWHUB_NAME}" \
49+
--version "${VERSION}" \
50+
--changelog "Release ${VERSION}" \
51+
--tags latest

0 commit comments

Comments
 (0)