From 3a8279e6f156b19f945a757ca11dbb454053b171 Mon Sep 17 00:00:00 2001 From: chendelian <116870791@qq.com> Date: Tue, 24 Mar 2026 11:28:15 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=B5=81=E6=B0=B4=E7=BA=BF=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release_skill.yaml | 70 ++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/release_skill.yaml diff --git a/.github/workflows/release_skill.yaml b/.github/workflows/release_skill.yaml new file mode 100644 index 0000000..f69734d --- /dev/null +++ b/.github/workflows/release_skill.yaml @@ -0,0 +1,70 @@ +name: 技能自动化发布 (测试版-无鉴权) +on: + push: + tags: ["v*"] + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + # 1. 下载源码 + - uses: actions/checkout@v3 + + # 2. 环境及工具准备 + - name: Setup Tools + run: pip install pyarmor requests python-frontmatter + + # 3. 【核心步骤】PyArmor 源代码混淆加密 + - name: Encrypt Source Code + run: | + mkdir -p dist/package + # 使用 PyArmor 加密 scripts 目录下的所有 Python 源码 + pyarmor gen -O dist/package scripts/*.py + # 拷贝说明文档到发包目录 + cp SKILL.md dist/package/ + + # 4. 提取元数据并物理打包 + - name: Parse Metadata and Pack + id: build_task + run: | + python -c " + import frontmatter, os, json, shutil + post = frontmatter.load('SKILL.md') + metadata = post.metadata + slug = metadata['name'] + version = metadata['version'] + # 设置变量供后续 API 调用使用 + print(f'::set-output name=slug::{slug}') + print(f'::set-output name=version::{version}') + print(f'::set-output name=metadata::{json.dumps(metadata)}') + # 制作最终的发布 ZIP 包 + shutil.make_archive(slug, 'zip', 'dist/package') + " + + # 5. 同步数据库记录 (对应接口: /api/skill/update) + - name: Sync Database (V2.0) + run: | + python -c " + import requests, json + metadata = json.loads('${{ steps.build_task.outputs.metadata }}') + # 严谨修正:接口路径为 /api/skill/update + url = 'https://jc2009.com/api/skill/update' + res = requests.post(url, json=metadata) + print(f'DB Sync Result: {res.text}') + if res.status_code != 200: exit(1) + " + + # 6. 上传物理包 (对应接口: /api/upload) + - name: Upload Encrypted ZIP + run: | + SLUG=${{ steps.build_task.outputs.slug }} + VERSION=${{ steps.build_task.outputs.version }} + python -c " + import requests + url = 'https://jc2009.com/api/upload' + payload = {'plugin_name': '$SLUG', 'version': '$VERSION'} + with open(f'$SLUG.zip', 'rb') as f: + res = requests.post(url, data=payload, files={'file': f}) + print(f'Upload Result: {res.text}') + if res.status_code != 200: exit(1) + "