-
Notifications
You must be signed in to change notification settings - Fork 6
feat: mcp server for validate plugin #518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
85ce6c7
c5ccd77
1883e3e
e2d30cf
05ccceb
4d104ef
7192e2d
3c1a00e
40b20f3
f4a7346
ab1bdb8
7856e55
a1c63be
61a5259
317e839
ea7555b
fb0f3cf
1288300
5ba0fcf
9888117
16ce2d6
947a09d
eba3b0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| name: Release MCP Server | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: "Semver type of new version (major / minor / patch)" | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - patch | ||
| - minor | ||
| - major | ||
|
|
||
| jobs: | ||
| release-mcp: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - id: get-secrets | ||
| uses: grafana/shared-workflows/actions/get-vault-secrets@a37de51f3d713a30a9e4b21bcdfbd38170020593 # v1.3.0 | ||
| with: | ||
| repo_secrets: | | ||
| GITHUB_APP_ID=plugins-platform-bot-app:app_id | ||
| GITHUB_APP_PRIVATE_KEY=plugins-platform-bot-app:app_pem | ||
| export_env: false | ||
|
|
||
| - name: Generate token | ||
| id: generate_token | ||
| uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1 | ||
| with: | ||
| app-id: ${{ fromJSON(steps.get-secrets.outputs.secrets).GITHUB_APP_ID }} | ||
| private-key: ${{ fromJSON(steps.get-secrets.outputs.secrets).GITHUB_APP_PRIVATE_KEY }} | ||
| permission-contents: write | ||
|
|
||
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
| with: | ||
| token: ${{ steps.generate_token.outputs.token }} | ||
| persist-credentials: true | ||
|
|
||
| - name: Setup Git | ||
| run: | | ||
| git config user.name 'grafana-plugins-platform-bot[bot]' | ||
| git config user.email '144369747+grafana-plugins-platform-bot[bot]@users.noreply.github.com' | ||
|
|
||
| - uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 | ||
| with: | ||
| node-version: "24" | ||
|
|
||
| - name: Bump MCP version and create tag | ||
| run: | | ||
| cd mcp-package | ||
| npm version ${INPUT_VERSION} --no-git-tag-version | ||
| NEW_VERSION=$(jq -r .version package.json) | ||
| cd .. | ||
|
|
||
| git add mcp-package/package.json | ||
| git commit -m "chore(mcp): release v${NEW_VERSION}" | ||
| git tag "mcp/v${NEW_VERSION}" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We manually tag with
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| env: | ||
| INPUT_VERSION: ${{ github.event.inputs.version }} | ||
|
|
||
| - name: Push changes and tag | ||
| run: | | ||
| git push origin main | ||
| git push origin --tags | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| name: Create MCP release and publish to github and npm | ||
|
|
||
| on: # zizmor: ignore[cache-poisoning] | ||
| push: | ||
| tags: | ||
| - "mcp/v[0-9]*" | ||
|
|
||
| jobs: | ||
| release-mcp-to-github: | ||
| runs-on: ubuntu-arm64 | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 | ||
| with: | ||
| go-version-file: go.mod | ||
| check-latest: true | ||
|
|
||
| - id: get-secrets | ||
| uses: grafana/shared-workflows/actions/get-vault-secrets@a37de51f3d713a30a9e4b21bcdfbd38170020593 # v1.3.0 | ||
| with: | ||
| repo_secrets: | | ||
| GITHUB_APP_ID=plugins-platform-bot-app:app_id | ||
| GITHUB_APP_PRIVATE_KEY=plugins-platform-bot-app:app_pem | ||
| export_env: false | ||
|
|
||
| - name: Generate token | ||
| id: generate_token | ||
| uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1 | ||
| with: | ||
| app-id: ${{ fromJSON(steps.get-secrets.outputs.secrets).GITHUB_APP_ID }} | ||
| private-key: ${{ fromJSON(steps.get-secrets.outputs.secrets).GITHUB_APP_PRIVATE_KEY }} | ||
| permission-contents: write | ||
|
|
||
| - name: Extract MCP version | ||
| run: echo "MCP_VERSION=${GITHUB_REF_NAME#mcp/v}" >> $GITHUB_ENV | ||
|
|
||
| - uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 | ||
| with: | ||
| distribution: goreleaser | ||
| version: latest | ||
| args: release --clean --config .goreleaser.mcp.yaml --skip=validate | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| env: | ||
| GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | ||
| GORELEASER_CURRENT_TAG: ${{ github.ref_name }} | ||
| MCP_VERSION: ${{ env.MCP_VERSION }} | ||
|
|
||
| release-mcp-to-npm: | ||
| runs-on: ubuntu-latest | ||
| needs: release-mcp-to-github | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 | ||
| with: | ||
| node-version: "24" | ||
| registry-url: "https://registry.npmjs.org" | ||
| - run: cd mcp-package && npm install | ||
| - run: cd mcp-package && npm publish | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # yaml-language-server: $schema=https://goreleaser.com/static/schema.json | ||
| # Separate goreleaser config for the MCP server. | ||
| # Triggered by mcp/v* tags independently of the main plugin-validator releases. | ||
| # MCP_VERSION env var must be set to the bare semver (e.g. "0.2.0") by the workflow. | ||
| version: 2 | ||
|
|
||
| project_name: plugin-validator-mcp | ||
|
|
||
| before: | ||
| hooks: | ||
| - go mod tidy | ||
|
|
||
| builds: | ||
| - id: mcpserver | ||
| main: ./pkg/cmd/mcpserver | ||
| binary: plugin-validator-mcp | ||
| goos: | ||
| - linux | ||
| - darwin | ||
| - windows | ||
| goarch: | ||
| - amd64 | ||
| - arm64 | ||
| env: | ||
| - CGO_ENABLED=0 | ||
| ldflags: | ||
| - -s -w -X main.version={{ .Env.MCP_VERSION }} | ||
|
|
||
| archives: | ||
| - name_template: "plugin-validator-mcp_{{ .Env.MCP_VERSION }}_{{ .Os }}_{{ .Arch }}" | ||
| formats: [tar.gz] | ||
|
|
||
| checksum: | ||
| name_template: "checksums.txt" | ||
|
|
||
| changelog: | ||
| disable: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--no-git-tag-versionso it does not auto commit and tag0.0.1. We need tomcp/vprefix.