Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cd131697d5 | |||
| 2e3ac2cfe7 | |||
| bea22d5e9e | |||
| 7759e0b376 | |||
| 92a9d61007 | |||
| 16b3f50dac |
54
.github/workflows/release_skill.yaml
vendored
54
.github/workflows/release_skill.yaml
vendored
@@ -8,7 +8,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
# 1. 下载源码
|
# 1. 下载源码
|
||||||
- uses: actions/checkout@v3
|
- uses: http://120.25.191.12:3000/admin/actions-checkout@v4
|
||||||
|
|
||||||
# 2. 环境及工具准备
|
# 2. 环境及工具准备
|
||||||
- name: Setup Tools
|
- name: Setup Tools
|
||||||
@@ -30,14 +30,36 @@ jobs:
|
|||||||
import frontmatter, os, json, shutil
|
import frontmatter, os, json, shutil
|
||||||
post = frontmatter.load('SKILL.md')
|
post = frontmatter.load('SKILL.md')
|
||||||
metadata = post.metadata
|
metadata = post.metadata
|
||||||
slug = metadata['name']
|
|
||||||
version = metadata['version']
|
# slug 优先从 openclaw.slug 读取,兼容历史用 name
|
||||||
|
openclaw_meta = metadata.get('metadata', {}).get('openclaw', {})
|
||||||
|
slug = (openclaw_meta.get('slug') or metadata.get('slug') or metadata.get('name') or '').strip()
|
||||||
|
if not slug:
|
||||||
|
raise Exception('SKILL.md 缺少 slug/name,无法构建发布包')
|
||||||
|
|
||||||
|
# 以 Git Tag 为准(自动模式)
|
||||||
|
ref_name = (os.environ.get('GITHUB_REF_NAME') or '').strip()
|
||||||
|
if not ref_name:
|
||||||
|
ref_name = (os.environ.get('GITHUB_REF') or '').strip().split('/')[-1]
|
||||||
|
if not ref_name.startswith('v'):
|
||||||
|
raise Exception(f'非法标签: {ref_name},要求以 v 开头,例如 v1.0.10')
|
||||||
|
|
||||||
|
version = ref_name.lstrip('v')
|
||||||
|
|
||||||
|
# 自动模式:SKILL.md 与 tag 不一致时仅告警,不阻塞发布
|
||||||
|
skill_version = str(metadata.get('version') or '').strip()
|
||||||
|
if skill_version and skill_version != version:
|
||||||
|
print(f'WARNING: SKILL.md version({skill_version}) != tag version({version}), using tag version')
|
||||||
|
|
||||||
|
# 统一覆盖,确保后续输出与上传完全一致
|
||||||
|
metadata['version'] = version
|
||||||
|
|
||||||
# 安全写入输出
|
# 安全写入输出
|
||||||
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
|
with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
|
||||||
f.write(f'slug={slug}\n')
|
f.write(f'slug={slug}\n')
|
||||||
f.write(f'version={version}\n')
|
f.write(f'version={version}\n')
|
||||||
f.write(f'metadata={json.dumps(metadata)}\n')
|
f.write(f'metadata={json.dumps(metadata, ensure_ascii=False)}\n')
|
||||||
|
|
||||||
# 制作最终的发布 ZIP 包
|
# 制作最终的发布 ZIP 包
|
||||||
shutil.make_archive(slug, 'zip', 'dist/package')
|
shutil.make_archive(slug, 'zip', 'dist/package')
|
||||||
"
|
"
|
||||||
@@ -53,7 +75,14 @@ jobs:
|
|||||||
url = 'https://jc2009.com/api/skill/update'
|
url = 'https://jc2009.com/api/skill/update'
|
||||||
res = requests.post(url, json=metadata)
|
res = requests.post(url, json=metadata)
|
||||||
print(f'DB Sync Result: {res.text}')
|
print(f'DB Sync Result: {res.text}')
|
||||||
if res.status_code != 200: exit(1)
|
if res.status_code != 200:
|
||||||
|
exit(1)
|
||||||
|
try:
|
||||||
|
payload = res.json()
|
||||||
|
except Exception:
|
||||||
|
exit(1)
|
||||||
|
if payload.get('code') != 200:
|
||||||
|
exit(1)
|
||||||
"
|
"
|
||||||
|
|
||||||
# 6. 上传物理包
|
# 6. 上传物理包
|
||||||
@@ -67,9 +96,16 @@ jobs:
|
|||||||
url = 'https://jc2009.com/api/upload'
|
url = 'https://jc2009.com/api/upload'
|
||||||
slug = os.environ['SLUG']
|
slug = os.environ['SLUG']
|
||||||
version = os.environ['VERSION']
|
version = os.environ['VERSION']
|
||||||
payload = {'plugin_name': slug, 'version': version}
|
payload = {'plugin_name': slug, 'version': version, 'artifact_type': 'skill'}
|
||||||
with open(f'{slug}.zip', 'rb') as f:
|
with open(f'{slug}.zip', 'rb') as f:
|
||||||
res = requests.post(url, data=payload, files={'file': f})
|
res = requests.post(url, data=payload, files={'file': f})
|
||||||
print(f'Upload Result: {res.text}')
|
print(f'Upload Result: {res.text}')
|
||||||
if res.status_code != 200: exit(1)
|
if res.status_code != 200:
|
||||||
"
|
exit(1)
|
||||||
|
try:
|
||||||
|
payload = res.json()
|
||||||
|
except Exception:
|
||||||
|
exit(1)
|
||||||
|
if payload.get('code') != 200:
|
||||||
|
exit(1)
|
||||||
|
"
|
||||||
39
SKILL.md
39
SKILL.md
@@ -1,16 +1,21 @@
|
|||||||
---
|
---
|
||||||
name: account-manager
|
name: 账号管理
|
||||||
description: 多平台多账号管理。管理各平台账号与Chrome Profile的对应关系,供publisher类Skill调用获取账号信息。
|
description: 多平台多账号管理。管理各平台账号与Chrome Profile的对应关系,供publisher类Skill调用获取账号信息。
|
||||||
version: 1.0.1
|
version: 1.0.1
|
||||||
author: 深圳匠厂科技有限公司
|
author: 深圳匠厂科技有限公司
|
||||||
metadata:
|
metadata:
|
||||||
openclaw:
|
openclaw:
|
||||||
|
slug: account-manager
|
||||||
emoji: "👤"
|
emoji: "👤"
|
||||||
|
category: "通用"
|
||||||
|
skill_type: 1
|
||||||
|
monthly_price: 0
|
||||||
|
yearly_price: 0
|
||||||
allowed-tools:
|
allowed-tools:
|
||||||
- bash
|
- bash
|
||||||
---
|
---
|
||||||
|
|
||||||
# 账号管理器
|
# 账号管理
|
||||||
|
|
||||||
## 使用时机
|
## 使用时机
|
||||||
|
|
||||||
@@ -23,32 +28,4 @@ allowed-tools:
|
|||||||
|
|
||||||
### 列出某平台所有账号
|
### 列出某平台所有账号
|
||||||
```bash
|
```bash
|
||||||
python3 {baseDir}/scripts/account.py list <platform>
|
python3 {baseDir}/scripts/account.py list <platform>
|
||||||
```
|
|
||||||
|
|
||||||
### 获取某个账号详情
|
|
||||||
```bash
|
|
||||||
python3 {baseDir}/scripts/account.py get <account_id>
|
|
||||||
```
|
|
||||||
|
|
||||||
### 初始化账号登录(首次使用,打开浏览器手动登录)
|
|
||||||
```bash
|
|
||||||
python3 {baseDir}/scripts/account.py login <account_id>
|
|
||||||
```
|
|
||||||
|
|
||||||
## 输出格式
|
|
||||||
|
|
||||||
- list:逐行返回账号ID和名称
|
|
||||||
- get:返回账号完整信息
|
|
||||||
- login:打开浏览器后提示用户手动完成登录
|
|
||||||
|
|
||||||
## 错误处理
|
|
||||||
|
|
||||||
- 账号不存在:提示"未找到该账号,请检查账号ID是否正确"
|
|
||||||
- 平台无账号:提示"该平台暂无账号,请先在accounts.json中添加"
|
|
||||||
|
|
||||||
## 注意事项
|
|
||||||
|
|
||||||
- 账号档案存储在 `accounts.json`,新增账号需手动编辑该文件
|
|
||||||
- Chrome Profile目录首次登录后自动创建,登录态永久保存
|
|
||||||
- 每个账号只需初始化登录一次
|
|
||||||
Reference in New Issue
Block a user