mirror of
https://ghfast.top/https://github.com/discourse/discourse-mcp.git
synced 2026-07-15 11:36:36 +08:00
65 lines
2.2 KiB
YAML
65 lines
2.2 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: "24"
|
|
cache: pnpm
|
|
- run: pnpm install
|
|
- run: pnpm typecheck
|
|
- run: pnpm build
|
|
- run: pnpm test
|
|
|
|
publish:
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
needs: lint
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
id-token: write
|
|
contents: write
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version: "24"
|
|
cache: pnpm
|
|
- run: pnpm install
|
|
- name: Create and push git tag
|
|
run: |
|
|
VERSION=$(node -p "require('./package.json').version")
|
|
if git ls-remote --tags origin | grep -q "refs/tags/v${VERSION}$"; then
|
|
echo "Tag v${VERSION} already exists, skipping"
|
|
else
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git tag -a "v${VERSION}" -m "Release v${VERSION}"
|
|
git push origin "v${VERSION}"
|
|
fi
|
|
- name: Publish package
|
|
run: pnpm publish -r --no-git-checks || echo "Version already published, skipping"
|
|
- name: Install mcp-publisher
|
|
run: |
|
|
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
|
|
- name: Sync server.json version from package.json
|
|
run: |
|
|
VERSION=$(node -p "require('./package.json').version")
|
|
node -e "const fs = require('fs'); const s = JSON.parse(fs.readFileSync('server.json')); s.version = '$VERSION'; s.packages[0].version = '$VERSION'; fs.writeFileSync('server.json', JSON.stringify(s, null, 2) + '\n')"
|
|
- name: Publish server to MCP Registry
|
|
run: |
|
|
./mcp-publisher login github-oidc
|
|
./mcp-publisher publish
|