mirror of
https://github.com/upstash/context7.git
synced 2026-09-14 19:09:34 +08:00
6255e26677
* init sdk and monorepo * init sdk and monorepo * comment cleanup * remove bun.lock * cleanup: remove sdk package and deps * update tsconfigs * chore: add temp changelog * ci: update scripts * ci: update github workflows * fmt: workflows * fix: search libraries response type * ci: update pack-mcpb script * update keywords and author * update eslint config for mcp * include license and readme in build * update release.yaml * add readme symlink * include readme in mcp package * chore: add canary release workflow and update configs * chore: format files * ci: add changeset check workflow * canary release trigger * ci: login to npm before release * bump mcp version on package * remove pr trigger from canary release * ci: remove package input * add mcp lint command * update format scripts
90 lines
3.1 KiB
YAML
90 lines
3.1 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
jobs:
|
|
release:
|
|
name: Release
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
id-token: write # Required for OIDC authentication with MCP Registry
|
|
contents: write
|
|
pull-requests: write
|
|
steps:
|
|
- name: Checkout Repo
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 9
|
|
|
|
- name: Configure npm authentication
|
|
run: |
|
|
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
|
|
|
|
- name: Install Dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build all packages
|
|
run: pnpm build
|
|
|
|
- name: Create Release PR or Publish
|
|
id: changesets
|
|
uses: changesets/action@v1
|
|
with:
|
|
publish: pnpm release
|
|
commit: "chore(release): version packages"
|
|
title: "chore(release): version packages"
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
- name: Check if MCP was published
|
|
id: check-mcp
|
|
if: steps.changesets.outputs.published == 'true'
|
|
run: |
|
|
PUBLISHED='${{ steps.changesets.outputs.publishedPackages }}'
|
|
if echo "$PUBLISHED" | jq -e '.[] | select(.name == "@upstash/context7-mcp")' > /dev/null; then
|
|
VERSION=$(echo "$PUBLISHED" | jq -r '.[] | select(.name == "@upstash/context7-mcp") | .version')
|
|
echo "mcp_published=true" >> $GITHUB_OUTPUT
|
|
echo "mcp_version=$VERSION" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Update version in MCP source file
|
|
if: steps.check-mcp.outputs.mcp_published == 'true'
|
|
run: |
|
|
VERSION="${{ steps.check-mcp.outputs.mcp_version }}"
|
|
sed -i "s/version: \"[0-9]*\.[0-9]*\.[0-9]*\"/version: \"$VERSION\"/" packages/mcp/src/index.ts
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add packages/mcp/src/index.ts
|
|
git commit -m "chore: update MCP version in source to $VERSION" || true
|
|
git push || true
|
|
|
|
- name: Update server.json
|
|
if: steps.check-mcp.outputs.mcp_published == 'true'
|
|
run: |
|
|
VERSION="${{ steps.check-mcp.outputs.mcp_version }}"
|
|
echo $(jq --arg v "$VERSION" '.version = $v | .packages[0].version = $v' server.json) > server.json
|
|
git add server.json
|
|
git commit -m "chore: update server.json to v$VERSION" || true
|
|
git push || true
|
|
|
|
- name: Publish to MCP Registry
|
|
if: steps.check-mcp.outputs.mcp_published == 'true'
|
|
run: |
|
|
curl -L "https://github.com/modelcontextprotocol/registry/releases/download/v1.3.3/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
|
|
./mcp-publisher login github-oidc
|
|
./mcp-publisher publish
|