diff --git a/.github/workflows/release_skill.yaml b/.github/workflows/release_skill.yaml index be669a1..f27ccc6 100644 --- a/.github/workflows/release_skill.yaml +++ b/.github/workflows/release_skill.yaml @@ -108,4 +108,31 @@ jobs: exit(1) if payload.get('code') != 200: exit(1) + " + + # 7. 清理旧版本(只保留最新1个) + - name: Prune Old Versions + env: + SLUG: ${{ steps.build_task.outputs.slug }} + VERSION: ${{ steps.build_task.outputs.version }} + run: | + python -c " + import requests, os + url = 'https://jc2009.com/api/artifacts/prune-old-versions' + payload = { + 'name': os.environ['SLUG'], + 'artifact_type': 'skill', + 'keep_count': 1, + 'protect_version': os.environ['VERSION'] + } + res = requests.post(url, json=payload) + print(f'Prune Result: {res.text}') + if res.status_code != 200: + exit(1) + try: + body = res.json() + except Exception: + exit(1) + if body.get('code') != 200: + exit(1) " \ No newline at end of file