- 添加 mipu-api 作为 git submodule (Claude Code Skill) - 迁移 API 文档源文件到 docs/ 目录统一维护 - 添加 Gitea Actions 工作流:tag推送自动打包docs并发布Release - Skill 运行时自动从 mipu-open Release 下载最新文档 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
59 lines
1.7 KiB
YAML
59 lines
1.7 KiB
YAML
name: Release Docs
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Package docs
|
|
run: |
|
|
if [ ! -d "docs" ]; then
|
|
echo "Error: docs directory not found"
|
|
exit 1
|
|
fi
|
|
TAG=${GITHUB_REF#refs/tags/}
|
|
echo "$TAG" > "docs/.version"
|
|
tar -czf /tmp/docs.tar.gz docs/
|
|
|
|
- name: Create Release
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
run: |
|
|
TAG=${GITHUB_REF#refs/tags/}
|
|
API="${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
|
|
|
|
# Create release
|
|
curl -sf -X POST "${API}/releases" \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{
|
|
\"tag_name\": \"${TAG}\",
|
|
\"name\": \"API文档 ${TAG}\",
|
|
\"body\": \"米普云航司API文档更新 ${TAG}\"
|
|
}"
|
|
|
|
# Get release ID
|
|
RELEASE_ID=$(curl -sf "${API}/releases/tags/${TAG}" \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
| jq -r '.id')
|
|
|
|
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then
|
|
echo "Error: failed to create release"
|
|
exit 1
|
|
fi
|
|
|
|
# Upload docs.tar.gz
|
|
curl -sf -X POST "${API}/releases/${RELEASE_ID}/assets?name=docs.tar.gz" \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
-H "Content-Type: multipart/form-data" \
|
|
-F "attachment=@/tmp/docs.tar.gz"
|
|
|
|
echo "Release ${TAG} created with docs.tar.gz"
|