Remove type dependency on @cfworker/json-schema (#1229) #2726
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| release: | |
| types: [published] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - run: npm ci | |
| - run: npm run check | |
| - run: npm run build | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node-version: [18, 24] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: npm | |
| - run: npm ci | |
| - run: npm test | |
| publish: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' | |
| environment: release | |
| needs: [build, test] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| registry-url: 'https://registry.npmjs.org' | |
| - run: npm ci | |
| - name: Determine npm tag | |
| id: npm-tag | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| # Check if this is a beta release | |
| if [[ "$VERSION" == *"-beta"* ]]; then | |
| echo "tag=--tag beta" >> $GITHUB_OUTPUT | |
| # Check if this release is from a non-main branch (patch/maintenance release) | |
| elif [[ "${{ github.event.release.target_commitish }}" != "main" ]]; then | |
| # Use "release-X.Y" as tag for old branch releases (e.g., "release-1.23" for 1.23.x) | |
| # npm tags are mutable pointers to versions (like "latest" pointing to 1.24.3). | |
| # Using "release-1.23" means users can `npm install @modelcontextprotocol/sdk@release-1.23` | |
| # to get the latest patch on that minor version, and the tag updates if we | |
| # release 1.23.2, 1.23.3, etc. | |
| # Note: Can't use "v1.23" because npm rejects tags that look like semver ranges. | |
| MAJOR_MINOR=$(echo "$VERSION" | cut -d. -f1,2) | |
| echo "tag=--tag release-${MAJOR_MINOR}" >> $GITHUB_OUTPUT | |
| else | |
| echo "tag=" >> $GITHUB_OUTPUT | |
| fi | |
| - run: npm publish --provenance --access public ${{ steps.npm-tag.outputs.tag }} | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |