This commit is contained in:
12
.github/workflows/release_skill.yaml
vendored
12
.github/workflows/release_skill.yaml
vendored
@@ -30,13 +30,14 @@ jobs:
|
||||
import frontmatter, os, json, shutil
|
||||
post = frontmatter.load('SKILL.md')
|
||||
metadata = post.metadata
|
||||
|
||||
# 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 为准(严格模式)
|
||||
# 以 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]
|
||||
@@ -44,17 +45,20 @@ jobs:
|
||||
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 != version:
|
||||
raise Exception(f'SKILL.md 版本({skill_version})与 Git Tag 版本({version})不一致')
|
||||
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:
|
||||
f.write(f'slug={slug}\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 包
|
||||
shutil.make_archive(slug, 'zip', 'dist/package')
|
||||
|
||||
Reference in New Issue
Block a user