diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..6522906 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,41 @@ +name: CD + +on: + push: + tags: ["v*"] + +jobs: + build-mcpb: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: "20" + - run: npm ci + working-directory: mcp-server + - run: npx mcpb pack + working-directory: mcp-server + - uses: actions/upload-artifact@v4 + with: + name: mcpb + path: mcp-server/*.mcpb + + release: + runs-on: ubuntu-latest + needs: build-mcpb + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + name: mcpb + path: dist/ + - name: Create release with .mcpb + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release create "${{ github.ref_name }}" dist/*.mcpb \ + --title "${{ github.ref_name }}" \ + --generate-notes diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index badc57b..57bef1b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,53 +16,3 @@ jobs: python-version: "3.12" - run: pip install -r requirements.txt - run: python -m unittest discover -v - - build-mcpb: - runs-on: ubuntu-latest - if: github.event_name == 'push' && github.ref == 'refs/heads/main' - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: "20" - - run: npm ci - working-directory: mcp-server - - run: npx mcpb pack - working-directory: mcp-server - - uses: actions/upload-artifact@v4 - with: - name: mcpb - path: mcp-server/*.mcpb - - tag-build: - runs-on: ubuntu-latest - needs: [test, build-mcpb] - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Create build tag - run: | - DATE=$(date -u +%Y-%m-%d) - N=1 - while git ls-remote --tags origin "refs/tags/build-${DATE}.${N}" | grep -q .; do - N=$((N + 1)) - done - TAG="build-${DATE}.${N}" - git tag "$TAG" - git push origin "$TAG" - echo "BUILD_TAG=$TAG" >> "$GITHUB_ENV" - - uses: actions/download-artifact@v4 - with: - name: mcpb - path: dist/ - - name: Upload .mcpb to build tag release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release create "$BUILD_TAG" dist/*.mcpb \ - --title "$BUILD_TAG" \ - --notes "Automated build" \ - --prerelease diff --git a/docs/0-requirements.md b/docs/0-requirements.md index aeb4135..4ed8973 100644 --- a/docs/0-requirements.md +++ b/docs/0-requirements.md @@ -236,6 +236,28 @@ Node.js MCP サーバーは環境変数のみで構成する(CLI 引数なし Node.js >= 18.0.0 が必要。 +## CI/CD + +### テスト(CI) + +| トリガー | ジョブ | 内容 | +|---------|--------|------| +| PR to main / push to main | test | Python unittest | + +### リリース(CD) + +| トリガー | ジョブ | 内容 | +|---------|--------|------| +| `v*` タグ push | build-mcpb | `mcpb pack` で .mcpb 生成 | +| `v*` タグ push | release | GitHub Release 作成 + .mcpb 添付 | + +リリースフロー: +1. `npm version patch/minor/major` で package.json 更新 + `v*` タグ作成 +2. `git push origin main --tags` でタグ push +3. CD が自動実行: .mcpb 生成 → release 作成 → .mcpb 添付 + +バージョン管理は npm (package.json) が正。manifest.json のバージョンも一致させる。 + ## Infrastructure | コンポーネント | 用途 |